27 lines
971 B
Python
Executable File
27 lines
971 B
Python
Executable File
# /opt/docker/dev/service_finder/backend/app/models/marketplace/logistics.py
|
|
import enum
|
|
from typing import Optional
|
|
from sqlalchemy import Integer, String, Enum
|
|
from sqlalchemy.dialects.postgresql import ENUM as PG_ENUM
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
from app.db.base_class import Base
|
|
|
|
class LocationType(str, enum.Enum):
|
|
stop = "stop"
|
|
warehouse = "warehouse"
|
|
client = "client"
|
|
|
|
class Location(Base):
|
|
__tablename__ = "locations"
|
|
__table_args__ = {"schema": "fleet"}
|
|
|
|
id: Mapped[int] = mapped_column(Integer, primary_key=True, index=True)
|
|
name: Mapped[str] = mapped_column(String)
|
|
type: Mapped[LocationType] = mapped_column(
|
|
PG_ENUM(LocationType, name="location_type", inherit_schema=True),
|
|
nullable=False
|
|
)
|
|
|
|
coordinates: Mapped[Optional[str]] = mapped_column(String)
|
|
address_full: Mapped[Optional[str]] = mapped_column(String)
|
|
capacity: Mapped[Optional[int]] = mapped_column(Integer) |