
- Setup project structure and FastAPI application - Create SQLite database with SQLAlchemy - Implement user authentication with JWT - Create task and user models - Add CRUD operations for tasks and users - Configure Alembic for database migrations - Implement API endpoints for task management - Add error handling and validation - Configure CORS middleware - Create health check endpoint - Add comprehensive documentation
45 lines
947 B
Python
45 lines
947 B
Python
from datetime import datetime
|
|
from typing import Optional
|
|
|
|
from pydantic import BaseModel, EmailStr
|
|
|
|
|
|
# Shared properties
|
|
class UserBase(BaseModel):
|
|
email: Optional[EmailStr] = None
|
|
username: Optional[str] = None
|
|
is_active: Optional[bool] = True
|
|
is_superuser: Optional[bool] = False
|
|
full_name: Optional[str] = None
|
|
|
|
|
|
# Properties to receive via API on creation
|
|
class UserCreate(UserBase):
|
|
email: EmailStr
|
|
username: str
|
|
password: str
|
|
|
|
|
|
# Properties to receive via API on update
|
|
class UserUpdate(UserBase):
|
|
password: Optional[str] = None
|
|
|
|
|
|
# Additional properties to return via API
|
|
class UserInDBBase(UserBase):
|
|
id: str
|
|
created_at: datetime
|
|
updated_at: Optional[datetime] = None
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
# Additional properties stored in DB
|
|
class UserInDB(UserInDBBase):
|
|
hashed_password: str
|
|
|
|
|
|
# Additional properties to return via API
|
|
class User(UserInDBBase):
|
|
pass |