Phase 3.1: Enhanced Chore Logging and Reporting System
This commit is contained in:
47
backend/app/schemas/user.py
Normal file
47
backend/app/schemas/user.py
Normal file
@@ -0,0 +1,47 @@
|
||||
"""User schemas."""
|
||||
from pydantic import BaseModel, Field
|
||||
from datetime import datetime, date
|
||||
from typing import Optional
|
||||
|
||||
class UserBase(BaseModel):
|
||||
"""Base user schema."""
|
||||
username: str
|
||||
email: str # Changed from EmailStr to allow .local domains for home networks
|
||||
full_name: Optional[str] = None
|
||||
discord_id: Optional[str] = None
|
||||
profile_picture: Optional[str] = None
|
||||
avatar_url: Optional[str] = None
|
||||
birthday: Optional[date] = None
|
||||
|
||||
class UserCreate(UserBase):
|
||||
"""Schema for creating a user."""
|
||||
password: str
|
||||
|
||||
class UserUpdate(BaseModel):
|
||||
"""Schema for updating a user."""
|
||||
email: Optional[str] = None
|
||||
full_name: Optional[str] = None
|
||||
discord_id: Optional[str] = None
|
||||
profile_picture: Optional[str] = None
|
||||
birthday: Optional[date] = None
|
||||
password: Optional[str] = None
|
||||
is_active: Optional[bool] = None
|
||||
|
||||
class UserAdminUpdate(UserUpdate):
|
||||
"""Schema for admin updating a user (includes admin-only fields)."""
|
||||
is_admin: Optional[bool] = None
|
||||
|
||||
class UserResponse(UserBase):
|
||||
"""Schema for user response."""
|
||||
id: int
|
||||
is_active: bool
|
||||
is_admin: bool
|
||||
created_at: datetime
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
class UserLogin(BaseModel):
|
||||
"""Schema for user login."""
|
||||
username: str
|
||||
password: str
|
||||
Reference in New Issue
Block a user