|
1234567891011121314151617181920212223242526272829303132 |
- # 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)
- LastName: str = Field(..., min_length=3, max_length=50)
- ContactNumber: 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 | None
- LastName: str
- ContactNumber: str
- BirthDate: datetime
- Email: EmailStr
- Role: str
- AssignedVehicle: int | None
-
- class Config:
- orm_mode = True
- validate_assignment = True
|