From bf985d6fc95b59d47d04a4792e5691740f0f61b2 Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Wed, 9 Apr 2025 13:19:36 +0000 Subject: [PATCH] feat: Add Route schemas --- schemas/route.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 schemas/route.py 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