feat: Add Route schemas
This commit is contained in:
parent
2defb8a8d4
commit
bf985d6fc9
28
schemas/route.py
Normal file
28
schemas/route.py
Normal 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
|
Loading…
x
Reference in New Issue
Block a user