Skip to content

Commit ef708eb

Browse files
committed
fixed formatting errors
1 parent 627aa94 commit ef708eb

File tree

2 files changed

+12
-24
lines changed

2 files changed

+12
-24
lines changed

backend/python/app/models/route_stops.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,8 @@
1212
class RouteStopBase(SQLModel):
1313
"""Shared fields between table and API models"""
1414

15-
route_id: UUID = Field(
16-
foreign_key="routes.route_id"
17-
)
18-
location_id: UUID = Field(
19-
foreign_key="locations.location_id"
20-
)
15+
route_id: UUID = Field(foreign_key="routes.route_id")
16+
location_id: UUID = Field(foreign_key="locations.location_id")
2117
stop_number: int = Field(ge=1) # Stop number in the route sequence
2218

2319

@@ -26,11 +22,7 @@ class RouteStop(RouteStopBase, BaseModel, table=True):
2622

2723
__tablename__ = "route_stops"
2824

29-
route_stop_id: UUID = Field(
30-
default=uuid4,
31-
primary_key=True,
32-
nullable=False
33-
)
25+
route_stop_id: UUID = Field(default=uuid4, primary_key=True, nullable=False)
3426

3527
# Relationship back to route
3628
route: "Route" = Relationship(back_populates="route_stops")
@@ -53,4 +45,4 @@ class RouteStopUpdate(SQLModel):
5345

5446
route_id: UUID | None = None
5547
location_id: UUID | None = None
56-
stop_number: int | None = None
48+
stop_number: int | None = None

backend/python/app/models/routes.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,25 @@
1111

1212
class RouteBase(SQLModel):
1313
"""Shared fields between table and API models"""
14-
name: str = Field(default="", min_length=1, max_length=255) # can change this later
15-
notes: str = Field(default="", max_length=1000) # can change this later
14+
15+
name: str = Field(default="", min_length=1, max_length=255) # can change this later
16+
notes: str = Field(default="", max_length=1000) # can change this later
1617
length: float = Field(ge=0.0) # in km, must be non-negative
1718

1819

1920
class Route(RouteBase, BaseModel, table=True):
2021
"""Database table model for Routes
21-
22+
2223
Note: Routes are immutable once created
2324
"""
2425

2526
__tablename__ = "routes"
2627

27-
route_id: UUID = Field(
28-
default=uuid4,
29-
primary_key=True,
30-
nullable=False
31-
)
28+
route_id: UUID = Field(default=uuid4, primary_key=True, nullable=False)
3229

3330
# Relationship to route stops
3431
route_stops: list["RouteStop"] = Relationship(
35-
back_populates="route",
36-
sa_relationship_kwargs={"cascade": "all, delete-orphan"}
32+
back_populates="route", sa_relationship_kwargs={"cascade": "all, delete-orphan"}
3733
)
3834

3935

@@ -51,11 +47,11 @@ class RouteRead(RouteBase):
5147

5248
class RouteUpdate(SQLModel):
5349
"""Update request model - all optional
54-
50+
5551
Note: Routes are meant to be immutable, but this allows updates if needed
5652
"""
5753

5854
route_group_id: UUID | None = None
5955
name: str | None = None
6056
notes: str | None = None
61-
length: float | None = None
57+
length: float | None = None

0 commit comments

Comments
 (0)