feat: Add Route schemas

This commit is contained in:
Backend IM Bot 2025-04-09 13:19:36 +00:00
parent 2defb8a8d4
commit bf985d6fc9

28
schemas/route.py Normal file
View File

@ -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