You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

пре 1 година
пре 1 година
пре 1 година
пре 1 година
пре 1 година
пре 1 година
пре 1 година
пре 1 година
пре 1 година
123456789101112131415161718192021222324252627282930313233343536373839
  1. # Purpose: User schema for pydantic (validation, inside-api usage)
  2. from pydantic import BaseModel, EmailStr, Field
  3. from schemas.vehicle import OutputVehicle
  4. class UserCreate(BaseModel):
  5. Email: EmailStr
  6. Password: str = Field(..., min_length=7, max_length=20)
  7. Name: str = Field(..., min_length=3, max_length=50)
  8. MiddleName: str = Field(None)
  9. LastName: str = Field(..., min_length=3, max_length=50)
  10. ContactNumber: str = Field(..., min_length=12, max_length=12)
  11. GovernmentId: str = Field(...)
  12. Address: str = Field(...)
  13. Email: EmailStr = 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 ShowDriver(ShowUser):
  30. DrivingLicenseNumber: str | None
  31. AssignedVehicle: OutputVehicle | None