您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

1234567891011121314151617181920212223242526272829303132
  1. # Purpose: User schema for pydantic (validation, inside-api usage)
  2. from datetime import datetime
  3. from pydantic import BaseModel, EmailStr, Field
  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. BirthDate: datetime = Field(...)
  12. Email: EmailStr = Field(...)
  13. Role: str = Field(..., min_length=3, max_length=50)
  14. class ShowUser(BaseModel):
  15. Id: int
  16. Name: str
  17. MiddleName: str | None
  18. LastName: str
  19. ContactNumber: str
  20. BirthDate: datetime
  21. Email: EmailStr
  22. Role: str
  23. AssignedVehicle: int | None
  24. class Config:
  25. orm_mode = True
  26. validate_assignment = True