59 lines
1.8 KiB
Python
59 lines
1.8 KiB
Python
from pydantic import BaseModel, Field
|
|
from typing import Optional
|
|
from datetime import datetime
|
|
from uuid import UUID
|
|
|
|
class RideBase(BaseModel):
|
|
dispatch_status: str
|
|
dispatch_time: Optional[datetime.datetime]
|
|
dispatch_status: str
|
|
dispatch_time: Optional[datetime.datetime]
|
|
dispatch_status: str
|
|
dispatch_time: Optional[datetime.datetime]
|
|
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):
|
|
dispatch_status: str
|
|
dispatch_time: Optional[datetime.datetime]
|
|
dispatch_status: str
|
|
dispatch_time: Optional[datetime.datetime]
|
|
dispatch_status: str
|
|
dispatch_time: Optional[datetime.datetime]
|
|
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
|
|
|
|
|
|
dispatch_status: str
|
|
dispatch_time: Optional[datetime.datetime]
|
|
|
|
|
|
|
|
|
|
dispatch_status: str
|
|
dispatch_time: Optional[datetime.datetime]
|
|
|
|
|
|
|
|
|
|
dispatch_status: str
|
|
dispatch_time: Optional[datetime.datetime]
|
|
|