Initial commit: SIBU 2.0 MISSION
This commit is contained in:
35
backend/app/models/bus_stop.py
Normal file
35
backend/app/models/bus_stop.py
Normal file
@ -0,0 +1,35 @@
|
||||
"""Bus stop model."""
|
||||
from sqlmodel import SQLModel, Field, Column
|
||||
from datetime import datetime
|
||||
from typing import Optional
|
||||
from enum import Enum
|
||||
from uuid import UUID, uuid4
|
||||
from sqlalchemy import DateTime, func
|
||||
|
||||
|
||||
class StopType(str, Enum):
|
||||
"""Stop type enumeration."""
|
||||
TERMINAL = "terminal"
|
||||
REGULAR = "regular"
|
||||
EXPRESS_ONLY = "express_only"
|
||||
|
||||
|
||||
class BusStop(SQLModel, table=True):
|
||||
"""Bus stop model."""
|
||||
|
||||
__tablename__ = "bus_stops"
|
||||
|
||||
id: Optional[UUID] = Field(default_factory=uuid4, primary_key=True)
|
||||
name: str
|
||||
latitude: float
|
||||
longitude: float
|
||||
city: str
|
||||
address: Optional[str] = None
|
||||
stop_type: StopType = StopType.REGULAR
|
||||
has_shelter: bool = False
|
||||
has_seating: bool = False
|
||||
is_accessible: bool = False
|
||||
stop_order: Optional[int] = None
|
||||
created_at: Optional[datetime] = Field(sa_column=Column(DateTime, server_default=func.now()))
|
||||
updated_at: Optional[datetime] = Field(sa_column=Column(DateTime, server_default=func.now(), onupdate=func.now()))
|
||||
|
||||
Reference in New Issue
Block a user