#19 Driver model
This commit is contained in:
parent
20ca275a48
commit
1fa65f97b4
|
|
@ -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(
|
||||
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])
|
||||
driver: Optional[Driver] = Field(
|
||||
None,
|
||||
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 "
|
||||
|
|
|
|||
Loading…
Reference in a new issue