
- Added filtering and pagination for todo listings - Fixed Alembic migration setup - Enhanced CRUD operations - Updated documentation with comprehensive README - Linted code with Ruff
40 lines
701 B
Python
40 lines
701 B
Python
from typing import Optional
|
|
|
|
from pydantic import BaseModel
|
|
|
|
|
|
# Shared properties
|
|
class TodoBase(BaseModel):
|
|
title: Optional[str] = None
|
|
description: Optional[str] = None
|
|
is_completed: Optional[bool] = False
|
|
|
|
|
|
# Properties to receive on item creation
|
|
class TodoCreate(TodoBase):
|
|
title: str
|
|
|
|
|
|
# Properties to receive on item update
|
|
class TodoUpdate(TodoBase):
|
|
pass
|
|
|
|
|
|
# Properties shared by models stored in DB
|
|
class TodoInDBBase(TodoBase):
|
|
id: int
|
|
title: str
|
|
owner_id: int
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
# Properties to return to client
|
|
class Todo(TodoInDBBase):
|
|
pass
|
|
|
|
|
|
# Properties properties stored in DB
|
|
class TodoInDB(TodoInDBBase):
|
|
pass |