user.py 571 B

1234567891011121314151617181920212223242526
  1. from lib2to3.pgen2.token import OP
  2. from typing import Optional
  3. from pydantic import BaseModel, EmailStr
  4. # Shared properties
  5. class UserBase(BaseModel):
  6. userid: Optional[str] = None
  7. useraddress: Optional[str] = None
  8. email: EmailStr
  9. is_active: Optional[bool] = True
  10. is_superuser: bool = False
  11. account: Optional[str] = None
  12. # Properties to receive via API on creation
  13. class UserCreate(UserBase):
  14. hashed_password: str
  15. class UserUpdate(UserBase):
  16. hashed_password: Optional[str] = None
  17. class User(UserCreate):
  18. id: Optional[int] = None