Automated Action 2f75e43b7f Implement Todo API application with FastAPI and SQLite
- Created project structure with FastAPI setup
- Added SQLite database connection with SQLAlchemy ORM
- Implemented Todo model and schemas
- Added CRUD operations for Todo items
- Created API endpoints for Todo management
- Added health check endpoint
- Configured Alembic for database migrations
- Updated project documentation in README.md
2025-05-24 22:41:36 +00:00

37 lines
795 B
Python

from datetime import datetime
from typing import Optional
from pydantic import BaseModel, Field
# Shared properties
class TodoBase(BaseModel):
title: str = Field(..., min_length=1, max_length=255)
description: Optional[str] = None
completed: Optional[bool] = False
# Properties to receive via API on creation
class TodoCreate(TodoBase):
pass
# Properties to receive via API on update
class TodoUpdate(BaseModel):
title: Optional[str] = Field(None, min_length=1, max_length=255)
description: Optional[str] = None
completed: Optional[bool] = None
class TodoInDBBase(TodoBase):
id: int
created_at: datetime
updated_at: datetime
class Config:
orm_mode = True
# Additional properties to return via API
class Todo(TodoInDBBase):
pass