#19 Driver model

This commit is contained in:
Csaba 2024-01-22 11:23:04 +01:00
parent 20ca275a48
commit 1fa65f97b4

View file

@ -176,6 +176,26 @@ class RidesharingInfo(BaseModel):
min_length=1,
max_length=48)
class Driver(BaseModel):
driver_id: Optional[str] = Field(
None,
description="Identifies the driver.",
min_length=1,
max_length=256,
pattern='^[a-zA-Z0-9_-]+$',
examples=["789"])
profile_picture: Optional[HttpUrl] = Field(
None,
description="URL that contains the profile picture",
examples=["https://mfdz.de/driver/789/picture"])
rating: Optional[int] = Field(
None,
description="Rating of the driver from 1 to 5."
"0 no rating yet",
ge=0,
le=5,
examples=[5])
class Agency(BaseModel):
id: str = Field(
description="ID of the agency.",
@ -243,7 +263,6 @@ class Agency(BaseModel):
#"""
})
# TODO: add driver model class and add it to carpool as an optional field
class Carpool(BaseModel):
id: str = Field(
description="ID of the carpool. Should be supplied and managed by the "
@ -262,24 +281,16 @@ class Carpool(BaseModel):
pattern='^[a-zA-Z0-9]+$',
examples=["mfdz"])
driver_id: Optional[str] = Field(
driver: Optional[Driver] = Field(
None,
description="Identifies the driver.",
min_length=1,
max_length=256,
pattern='^[a-zA-Z0-9_-]+$',
examples=["789"])
driver_profile_picture: Optional[HttpUrl] = Field(
None,
description="URL that contains the profile picture",
examples=["https://mfdz.de/driver/789/picture"])
driver_rating: Optional[int] = Field(
None,
description="Rating of the driver from 1 to 5."
"0 no rating yet",
ge=0,
le=5,
examples=[5])
description="Driver data",
examples=["""
{
"driver_id": "123",
"profile_picture": "https://mfdz.de/driver/789/picture",
"rating": 5
}
"""])
deeplink: HttpUrl = Field(
description="Link to an information page providing detail information "