
- Set up project structure and FastAPI application - Create Todo database model with SQLAlchemy - Configure Alembic for database migrations - Implement CRUD endpoints for managing Todo items - Add health check endpoint - Include comprehensive documentation in README.md - Configure and apply Ruff linting
44 lines
797 B
Python
44 lines
797 B
Python
from datetime import datetime
|
|
from typing import Optional
|
|
|
|
from pydantic import BaseModel
|
|
|
|
|
|
class TodoBase(BaseModel):
|
|
"""Base schema for Todo items"""
|
|
|
|
title: str
|
|
description: Optional[str] = None
|
|
completed: bool = False
|
|
|
|
|
|
class TodoCreate(TodoBase):
|
|
"""Schema for creating a new Todo item"""
|
|
|
|
pass
|
|
|
|
|
|
class TodoUpdate(BaseModel):
|
|
"""Schema for updating a Todo item"""
|
|
|
|
title: Optional[str] = None
|
|
description: Optional[str] = None
|
|
completed: Optional[bool] = None
|
|
|
|
|
|
class TodoInDBBase(TodoBase):
|
|
"""Base schema for Todo items from the database"""
|
|
|
|
id: int
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
class Todo(TodoInDBBase):
|
|
"""Schema for Todo items returned from the API"""
|
|
|
|
pass
|