Automated Action 5e499461d7 Create simple FastAPI Todo application
- Set up project structure with FastAPI
- Create Todo model with SQLAlchemy
- Set up Alembic for database migrations
- Implement CRUD operations for todos
- Add health endpoint
- Update README with setup and usage instructions

generated with BackendIM... (backend.im)
2025-05-13 05:00:15 +00:00

28 lines
639 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] = None
completed: bool = False
class TodoCreate(TodoBase):
pass
class TodoUpdate(BaseModel):
title: Optional[str] = Field(None, min_length=1, max_length=100)
description: Optional[str] = None
completed: Optional[bool] = None
class TodoInDBBase(TodoBase):
id: int
created_at: datetime
updated_at: datetime
class Config:
from_attributes = True
class Todo(TodoInDBBase):
pass