
- Set up project structure with FastAPI - Create SQLite database models with SQLAlchemy - Implement Alembic for migrations - Create API endpoints for todo operations - Add health check endpoint - Update README.md with comprehensive documentation generated with BackendIM... (backend.im)
24 lines
650 B
Python
24 lines
650 B
Python
from pydantic import BaseModel, Field
|
|
from typing import Optional
|
|
from datetime import datetime
|
|
|
|
class TodoBase(BaseModel):
|
|
title: str = Field(..., min_length=1, max_length=100)
|
|
description: Optional[str] = Field(None, max_length=1000)
|
|
completed: bool = False
|
|
|
|
class TodoCreate(TodoBase):
|
|
pass
|
|
|
|
class TodoUpdate(BaseModel):
|
|
title: Optional[str] = Field(None, min_length=1, max_length=100)
|
|
description: Optional[str] = Field(None, max_length=1000)
|
|
completed: Optional[bool] = None
|
|
|
|
class TodoResponse(TodoBase):
|
|
id: int
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
class Config:
|
|
from_attributes = True |