feat: Add Ride schemas
This commit is contained in:
parent
31489d3b2d
commit
d7709af0d6
29
schemas/ride.py
Normal file
29
schemas/ride.py
Normal file
@ -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
|
Loading…
x
Reference in New Issue
Block a user