
- Implement CRUD operations for todos - Add FastAPI with CORS middleware - Set up SQLite database with Alembic migrations - Include health endpoint and API documentation - Configure Ruff for code linting - Update README with comprehensive documentation
28 lines
536 B
Python
28 lines
536 B
Python
from pydantic import BaseModel
|
|
from typing import Optional
|
|
from datetime import datetime
|
|
|
|
|
|
class TodoBase(BaseModel):
|
|
title: str
|
|
description: Optional[str] = None
|
|
completed: bool = False
|
|
|
|
|
|
class TodoCreate(TodoBase):
|
|
pass
|
|
|
|
|
|
class TodoUpdate(BaseModel):
|
|
title: Optional[str] = None
|
|
description: Optional[str] = None
|
|
completed: Optional[bool] = None
|
|
|
|
|
|
class TodoResponse(TodoBase):
|
|
id: int
|
|
created_at: datetime
|
|
updated_at: Optional[datetime] = None
|
|
|
|
class Config:
|
|
from_attributes = True |