
- Set up project structure and dependencies - Implement Todo model with SQLAlchemy - Configure SQLite database connection - Create Alembic migration scripts - Implement RESTful API endpoints for CRUD operations - Add health check endpoint - Update README with documentation generated with BackendIM... (backend.im)
27 lines
616 B
Python
27 lines
616 B
Python
from pydantic import BaseModel
|
|
from datetime import datetime
|
|
from typing import Optional
|
|
|
|
# Shared properties
|
|
class TodoBase(BaseModel):
|
|
title: str
|
|
description: Optional[str] = None
|
|
completed: bool = False
|
|
|
|
# Properties to receive on creation
|
|
class TodoCreate(TodoBase):
|
|
pass
|
|
|
|
# Properties to receive on update
|
|
class TodoUpdate(TodoBase):
|
|
title: Optional[str] = None
|
|
completed: Optional[bool] = None
|
|
|
|
# Properties to return to client
|
|
class TodoResponse(TodoBase):
|
|
id: int
|
|
created_at: datetime
|
|
updated_at: Optional[datetime] = None
|
|
|
|
class Config:
|
|
from_attributes = True |