|
123456789101112131415161718192021222324252627282930 |
- # Purpose: User schema for pydantic (validation, inside-api usage)
-
- from datetime import datetime
- from pydantic import BaseModel, EmailStr, Field
-
-
- class UserCreate(BaseModel):
- email: EmailStr
- password: str = Field(..., min_length=7, max_length=20)
- name: str = Field(..., min_length=3, max_length=50)
- middlename: str = Field(None, min_length=3, max_length=50)
- lastname: str = Field(..., min_length=3, max_length=50)
- phone: str = Field(..., min_length=12, max_length=12)
- birthdate: datetime = Field(...)
- email: EmailStr = Field(...)
- role: str = Field(..., min_length=3, max_length=50)
-
-
- class ShowUser(BaseModel):
- Id: int
- Name: str
- MiddleName: str
- LastName: str
- ContactNumber: str
- BirthDate: datetime
- Email: EmailStr
- Role: str
-
- class Config:
- orm_mode = True
|