23 lines
477 B
Python
23 lines
477 B
Python
|
|
from pydantic import BaseModel, EmailStr
|
||
|
|
from typing import Optional
|
||
|
|
from datetime import datetime
|
||
|
|
|
||
|
|
class UserBase(BaseModel):
|
||
|
|
email: EmailStr
|
||
|
|
username: str
|
||
|
|
is_active: bool = True
|
||
|
|
is_superuser: bool = False
|
||
|
|
|
||
|
|
class UserCreate(UserBase):
|
||
|
|
password: str
|
||
|
|
|
||
|
|
class UserUpdate(UserBase):
|
||
|
|
password: Optional[str] = None
|
||
|
|
|
||
|
|
class UserResponse(UserBase):
|
||
|
|
id: int
|
||
|
|
created_at: datetime
|
||
|
|
updated_at: datetime
|
||
|
|
|
||
|
|
class Config:
|
||
|
|
from_attributes = True
|