Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 

34 rader
903 B

  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(..., 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. GovernmentId: str
  21. Address: str
  22. Email: EmailStr
  23. Role: str
  24. AssignedVehicle: int | None
  25. class Config:
  26. orm_mode = True
  27. validate_assignment = True