Automated Action c139318961 Implement simple Todo application with FastAPI and SQLite
- Set up project structure with FastAPI application
- Create Todo model and related Pydantic schemas
- Implement CRUD operations for Todo items
- Add health endpoint for application monitoring
- Configure database connection with SQLite
- Create database migrations with Alembic
- Update documentation with setup and usage instructions

generated with BackendIM... (backend.im)
2025-05-12 16:30:31 +00:00

32 lines
802 B
Python

from typing import Optional
from datetime import datetime
from pydantic import BaseModel, Field
# Shared properties
class TodoBase(BaseModel):
title: str = Field(..., min_length=1, max_length=100)
description: Optional[str] = Field(None, max_length=500)
completed: bool = False
# Properties to receive on todo creation
class TodoCreate(TodoBase):
pass
# Properties to receive on todo update
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
# Properties to return to client
class TodoResponse(TodoBase):
id: int
created_at: datetime
updated_at: Optional[datetime] = None
class Config:
from_attributes = True