#19 Driver model
This commit is contained in:
parent
20ca275a48
commit
1fa65f97b4
|
|
@ -176,6 +176,26 @@ class RidesharingInfo(BaseModel):
|
||||||
min_length=1,
|
min_length=1,
|
||||||
max_length=48)
|
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):
|
class Agency(BaseModel):
|
||||||
id: str = Field(
|
id: str = Field(
|
||||||
description="ID of the agency.",
|
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):
|
class Carpool(BaseModel):
|
||||||
id: str = Field(
|
id: str = Field(
|
||||||
description="ID of the carpool. Should be supplied and managed by the "
|
description="ID of the carpool. Should be supplied and managed by the "
|
||||||
|
|
@ -262,24 +281,16 @@ class Carpool(BaseModel):
|
||||||
pattern='^[a-zA-Z0-9]+$',
|
pattern='^[a-zA-Z0-9]+$',
|
||||||
examples=["mfdz"])
|
examples=["mfdz"])
|
||||||
|
|
||||||
driver_id: Optional[str] = Field(
|
driver: Optional[Driver] = Field(
|
||||||
None,
|
None,
|
||||||
description="Identifies the driver.",
|
description="Driver data",
|
||||||
min_length=1,
|
examples=["""
|
||||||
max_length=256,
|
{
|
||||||
pattern='^[a-zA-Z0-9_-]+$',
|
"driver_id": "123",
|
||||||
examples=["789"])
|
"profile_picture": "https://mfdz.de/driver/789/picture",
|
||||||
driver_profile_picture: Optional[HttpUrl] = Field(
|
"rating": 5
|
||||||
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])
|
|
||||||
|
|
||||||
deeplink: HttpUrl = Field(
|
deeplink: HttpUrl = Field(
|
||||||
description="Link to an information page providing detail information "
|
description="Link to an information page providing detail information "
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue