
- Create project structure and configuration files - Set up database models and schemas for ToDo items - Implement CRUD operations for ToDo management - Create API endpoints for ToDo operations - Add health check endpoint - Set up Alembic for database migrations - Add comprehensive README documentation
32 lines
700 B
Python
32 lines
700 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] = 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 TodoInDB(TodoBase):
|
|
id: int
|
|
created_at: datetime
|
|
updated_at: Optional[datetime] = None
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
class Todo(TodoInDB):
|
|
pass |