選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

user.py 837 B

123456789101112131415161718192021222324252627282930
  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, min_length=3, max_length=50)
  9. lastname: str = Field(..., min_length=3, max_length=50)
  10. phone: 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
  18. LastName: str
  19. ContactNumber: str
  20. BirthDate: datetime
  21. Email: EmailStr
  22. Role: str
  23. class Config:
  24. orm_mode = True