
- Fix unused imports in API endpoints - Add proper __all__ exports in model and schema modules - Add proper TYPE_CHECKING imports in models to prevent circular imports - Fix import order in migrations - Fix long lines in migration scripts - All ruff checks passing
60 lines
1.1 KiB
Python
60 lines
1.1 KiB
Python
from datetime import datetime
|
|
from typing import Optional
|
|
|
|
from pydantic import BaseModel, EmailStr
|
|
|
|
|
|
# Shared properties
|
|
class UserBase(BaseModel):
|
|
"""
|
|
Base schema for user data.
|
|
"""
|
|
email: Optional[EmailStr] = None
|
|
full_name: Optional[str] = None
|
|
is_active: Optional[bool] = True
|
|
is_superuser: bool = False
|
|
|
|
|
|
# Properties to receive via API on creation
|
|
class UserCreate(UserBase):
|
|
"""
|
|
Schema for creating new users.
|
|
"""
|
|
email: EmailStr
|
|
password: str
|
|
|
|
|
|
# Properties to receive via API on update
|
|
class UserUpdate(UserBase):
|
|
"""
|
|
Schema for updating user data.
|
|
"""
|
|
password: Optional[str] = None
|
|
|
|
|
|
class UserInDBBase(UserBase):
|
|
"""
|
|
Base schema for user data from the database.
|
|
"""
|
|
id: str
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
# Additional properties to return via API
|
|
class User(UserInDBBase):
|
|
"""
|
|
Schema for user data to return via API.
|
|
"""
|
|
pass
|
|
|
|
|
|
# Additional properties stored in DB
|
|
class UserInDB(UserInDBBase):
|
|
"""
|
|
Schema for user data stored in the database.
|
|
"""
|
|
hashed_password: str |