
- Created app/db/base.py with SQLAlchemy Base to avoid circular imports - Created app/db/session.py with SQLite database connection using /app/storage/db path - Created app/models/todo.py with Todo model including all required fields - Created app/schemas/todo.py with Pydantic schemas for request/response - Added requirements.txt with FastAPI, SQLAlchemy, and other dependencies - Created proper package structure with __init__.py files
28 lines
519 B
Python
28 lines
519 B
Python
from datetime import datetime
|
|
from typing import Optional
|
|
from pydantic import BaseModel
|
|
|
|
|
|
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: datetime
|
|
|
|
class Config:
|
|
from_attributes = True |