Automated Action e84ae05b4e Implement simple Todo application with FastAPI and SQLite
- Set up project structure
- Configure SQLite database connection
- Create Todo model and schema
- Implement CRUD API endpoints for todo items
- Add health check endpoint
- Update README with documentation

generated with BackendIM... (backend.im)
2025-05-13 11:24:31 +00:00

27 lines
669 B
Python

from datetime import datetime
from typing import Optional
from pydantic import BaseModel, Field
class TodoBase(BaseModel):
title: str = Field(..., min_length=1, max_length=100)
description: Optional[str] = Field(None, max_length=500)
completed: bool = False
class TodoCreate(TodoBase):
pass
class TodoUpdate(BaseModel):
title: Optional[str] = Field(None, min_length=1, max_length=100)
description: Optional[str] = Field(None, max_length=500)
completed: Optional[bool] = None
class TodoInDB(TodoBase):
id: int
created_at: datetime
updated_at: datetime
class Config:
orm_mode = True
class Todo(TodoInDB):
pass