
- Set up project structure with FastAPI - Configure SQLAlchemy with SQLite - Implement user and item models - Set up Alembic for database migrations - Create CRUD operations for models - Implement API endpoints for users and items - Add authentication functionality - Add health check endpoint - Configure Ruff for linting - Update README with comprehensive documentation
38 lines
720 B
Python
38 lines
720 B
Python
from typing import Optional
|
|
|
|
from pydantic import BaseModel, ConfigDict
|
|
|
|
|
|
class ItemBase(BaseModel):
|
|
"""Base schema for Item."""
|
|
title: str
|
|
description: Optional[str] = None
|
|
|
|
|
|
class ItemCreate(ItemBase):
|
|
"""Schema for creating a new Item."""
|
|
pass
|
|
|
|
|
|
class ItemUpdate(BaseModel):
|
|
"""Schema for updating an Item."""
|
|
title: Optional[str] = None
|
|
description: Optional[str] = None
|
|
|
|
|
|
class ItemInDBBase(ItemBase):
|
|
"""Base schema for Item in DB."""
|
|
id: int
|
|
owner_id: int
|
|
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
|
|
class Item(ItemInDBBase):
|
|
"""Schema for Item returned to the client."""
|
|
pass
|
|
|
|
|
|
class ItemInDB(ItemInDBBase):
|
|
"""Schema for Item in DB."""
|
|
pass |