
- Set up FastAPI application with CORS support - Implement SQLAlchemy models and database session management - Create CRUD API endpoints for items management - Configure Alembic for database migrations - Add health check and service info endpoints - Include comprehensive documentation and project structure - Integrate Ruff for code quality and formatting
24 lines
521 B
Python
24 lines
521 B
Python
from pydantic import BaseModel
|
|
from datetime import datetime
|
|
from typing import Optional
|
|
|
|
class ItemBase(BaseModel):
|
|
name: str
|
|
description: Optional[str] = None
|
|
is_active: bool = True
|
|
|
|
class ItemCreate(ItemBase):
|
|
pass
|
|
|
|
class ItemUpdate(BaseModel):
|
|
name: Optional[str] = None
|
|
description: Optional[str] = None
|
|
is_active: Optional[bool] = None
|
|
|
|
class Item(ItemBase):
|
|
id: int
|
|
created_at: datetime
|
|
updated_at: Optional[datetime] = None
|
|
|
|
class Config:
|
|
from_attributes = True |