Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 

48 righe
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. class DriverCreate(UserCreate):
  14. DrivingLicenseNumber: str = Field(...)
  15. class ShowUser(BaseModel):
  16. Id: int
  17. Name: str
  18. MiddleName: str | None
  19. LastName: str
  20. ContactNumber: str
  21. GovernmentId: str
  22. Address: str
  23. Email: EmailStr
  24. Role: str
  25. class Config:
  26. orm_mode = True
  27. validate_assignment = True
  28. class ShowDriverNoVehicle(ShowUser):
  29. DrivingLicenseNumber: str | None
  30. from schemas.vehicle import OutputVehicle
  31. class ShowDriver(ShowUser):
  32. DrivingLicenseNumber: str | None
  33. AssignedVehicle: OutputVehicle | None