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 jaar geleden
1 jaar geleden
1 jaar geleden
1 jaar geleden
1 jaar geleden
1 jaar geleden
1 jaar geleden
1 jaar geleden
1 jaar geleden
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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