46 lines
1.3 KiB
Python
46 lines
1.3 KiB
Python
from pydantic import BaseModel, Field
|
|
from typing import Optional
|
|
from datetime import datetime
|
|
from uuid import UUID
|
|
|
|
# Schema for creating a new Route
|
|
class RouteCreate(BaseModel):
|
|
waypoints: Optional[List[Any]]
|
|
optimized_distance: Optional[int]
|
|
optimized_duration: Optional[int]
|
|
waypoints: Optional[List[Any]]
|
|
optimized_distance: Optional[int]
|
|
optimized_duration: Optional[int]
|
|
name: str = Field(..., description="Name of the route")
|
|
description: Optional[str] = Field(None, description="Description of the route")
|
|
origin: str = Field(..., description="Origin location of the route")
|
|
destination: str = Field(..., description="Destination location of the route")
|
|
distance: int = Field(..., description="Distance of the route")
|
|
duration: int = Field(..., description="Duration of the route")
|
|
|
|
# Schema for Route responses
|
|
class RouteSchema(BaseModel):
|
|
id: UUID
|
|
name: str
|
|
description: Optional[str]
|
|
origin: str
|
|
destination: str
|
|
distance: int
|
|
duration: int
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
class Config:
|
|
orm_mode = True
|
|
|
|
|
|
waypoints: Optional[List[Any]]
|
|
optimized_distance: Optional[int]
|
|
optimized_duration: Optional[int]
|
|
|
|
|
|
|
|
waypoints: Optional[List[Any]]
|
|
optimized_distance: Optional[int]
|
|
optimized_duration: Optional[int]
|