first commit
This commit is contained in:
27
app/users/schemas.py
Normal file
27
app/users/schemas.py
Normal file
@@ -0,0 +1,27 @@
|
||||
from datetime import datetime
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, EmailStr, Field
|
||||
|
||||
|
||||
class UserBase(BaseModel):
|
||||
username: str = Field(min_length=3, max_length=50)
|
||||
email: EmailStr
|
||||
|
||||
|
||||
class UserCreate(UserBase):
|
||||
password: str = Field(min_length=8, max_length=128)
|
||||
|
||||
|
||||
class UserRead(UserBase):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: int
|
||||
avatar_url: str | None = None
|
||||
email_verified: bool
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
|
||||
class UserProfileUpdate(BaseModel):
|
||||
username: str | None = Field(default=None, min_length=3, max_length=50)
|
||||
avatar_url: str | None = Field(default=None, max_length=512)
|
||||
Reference in New Issue
Block a user