From d7709af0d63a4f9a2a0e8eed33c5a58632a2ce18 Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Wed, 9 Apr 2025 19:40:58 +0000 Subject: [PATCH] feat: Add Ride schemas --- schemas/ride.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 schemas/ride.py diff --git a/schemas/ride.py b/schemas/ride.py new file mode 100644 index 0000000..ed8880b --- /dev/null +++ b/schemas/ride.py @@ -0,0 +1,29 @@ +from pydantic import BaseModel, Field +from typing import Optional +from datetime import datetime +from uuid import UUID + +class RideBase(BaseModel): + pickup_location: str = Field(..., description="Pickup location") + drop_location: str = Field(..., description="Drop-off location") + pickup_latitude: float = Field(..., description="Pickup latitude") + pickup_longitude: float = Field(..., description="Pickup longitude") + drop_latitude: float = Field(..., description="Drop-off latitude") + drop_longitude: float = Field(..., description="Drop-off longitude") + rider_id: UUID = Field(..., description="ID of the rider") + +class RideCreate(RideBase): + pass + +class RideSchema(RideBase): + id: UUID + driver_id: Optional[UUID] = Field(None, description="ID of the driver") + ride_status: str = Field("requested", description="Status of the ride") + ride_distance: Optional[float] = Field(None, description="Distance of the ride") + ride_duration: Optional[int] = Field(None, description="Duration of the ride") + ride_fare: Optional[float] = Field(None, description="Fare for the ride") + created_at: datetime + updated_at: datetime + + class Config: + orm_mode = True \ No newline at end of file