
- Created main FastAPI application with CORS middleware - Added SQLite database configuration with SQLAlchemy - Implemented Items model with create, read, update, delete operations - Set up Alembic migrations for database schema management - Added comprehensive API endpoints at /api/v1/items/ - Included health check endpoint at /health - Added proper Pydantic schemas for request/response validation - Updated README with complete documentation and usage instructions - Configured Ruff for code linting and formatting
27 lines
462 B
Python
27 lines
462 B
Python
from pydantic import BaseModel
|
|
from datetime import datetime
|
|
from typing import Optional
|
|
|
|
|
|
class ItemBase(BaseModel):
|
|
name: str
|
|
description: Optional[str] = None
|
|
|
|
|
|
class ItemCreate(ItemBase):
|
|
pass
|
|
|
|
|
|
class ItemUpdate(BaseModel):
|
|
name: Optional[str] = None
|
|
description: Optional[str] = None
|
|
|
|
|
|
class Item(ItemBase):
|
|
id: int
|
|
created_at: datetime
|
|
updated_at: Optional[datetime] = None
|
|
|
|
class Config:
|
|
from_attributes = True
|