Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

49 рядки
1.1 KiB

  1. # Purpose: User schema for pydantic (validation, inside-api usage)
  2. from pydantic import BaseModel, EmailStr, Field
  3. class UserCreate(BaseModel):
  4. Email: EmailStr
  5. Password: str = Field(..., min_length=7, max_length=20)
  6. Name: str = Field(..., min_length=3, max_length=50)
  7. MiddleName: str = Field(None)
  8. LastName: str = Field(..., min_length=3, max_length=50)
  9. ContactNumber: str = Field(..., min_length=12, max_length=12)
  10. GovernmentId: str = Field(...)
  11. Address: str = Field(...)
  12. Email: EmailStr = Field(...)
  13. Role: str = Field(...)
  14. class DriverCreate(UserCreate):
  15. DrivingLicenseNumber: str = Field(...)
  16. class ShowUser(BaseModel):
  17. Id: int
  18. Name: str
  19. MiddleName: str | None
  20. LastName: str
  21. ContactNumber: str
  22. GovernmentId: str
  23. Address: str
  24. Email: EmailStr
  25. Role: str
  26. class Config:
  27. orm_mode = True
  28. validate_assignment = True
  29. class ShowDriverNoVehicle(ShowUser):
  30. DrivingLicenseNumber: str | None
  31. from schemas.vehicle import OutputVehicle
  32. class ShowDriver(ShowUser):
  33. DrivingLicenseNumber: str | None
  34. AssignedVehicle: OutputVehicle | None