diff --git a/schemas/route.py b/schemas/route.py new file mode 100644 index 0000000..f13958d --- /dev/null +++ b/schemas/route.py @@ -0,0 +1,28 @@ +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): + 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 \ No newline at end of file