
- Set up project structure with FastAPI and SQLite - Created Todo model with SQLAlchemy ORM - Added CRUD operations for todos - Implemented API endpoints for Todo operations - Added health check endpoint - Added Alembic for database migrations - Updated README with documentation generated with BackendIM... (backend.im)
25 lines
547 B
Python
25 lines
547 B
Python
from datetime import datetime
|
|
from typing import Optional
|
|
from pydantic import BaseModel
|
|
|
|
# Todo schemas
|
|
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 |