New coord_todos table and API endpoints (GET/POST/PUT/DELETE /api/coord/todos) supporting manual and auto-created items, sub-tasks via parent_id, and inclusive for_user/for_machine filters (OR-null) for sync/save display. sync.sh Phase 7 now shows pending todos grouped by project after every sync. CLAUDE.md documents auto-creation behavior for unresolved follow-up. Web/email pricing doc updated: block time rate clarified, INKY reference removed, dates updated. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
58 lines
2.2 KiB
Python
58 lines
2.2 KiB
Python
"""Pydantic schemas for CoordTodo."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from datetime import datetime
|
|
from typing import Optional
|
|
from uuid import UUID
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class CoordTodoCreate(BaseModel):
|
|
"""Input schema for creating a to-do item."""
|
|
|
|
text: str = Field(..., description="To-do item text")
|
|
project_key: Optional[str] = Field(None, description="Project scope; NULL = personal", max_length=100)
|
|
parent_id: Optional[UUID] = Field(None, description="Parent to-do ID for sub-tasks")
|
|
assigned_to_user: Optional[str] = Field(None, description="Target user, e.g. 'mike'", max_length=50)
|
|
assigned_to_machine: Optional[str] = Field(None, description="Target hostname", max_length=100)
|
|
auto_created: bool = Field(False, description="True when Claude auto-generated this item")
|
|
source_context: Optional[str] = Field(None, description="Why Claude auto-created this item")
|
|
created_by_user: str = Field(..., description="User creating the item", max_length=50)
|
|
created_by_machine: str = Field(..., description="Hostname where the item is created", max_length=100)
|
|
|
|
|
|
class CoordTodoUpdate(BaseModel):
|
|
"""Input schema for updating a to-do item."""
|
|
|
|
text: Optional[str] = None
|
|
status: Optional[str] = Field(None, description="pending / done / cancelled")
|
|
assigned_to_user: Optional[str] = Field(None, max_length=50)
|
|
assigned_to_machine: Optional[str] = Field(None, max_length=100)
|
|
project_key: Optional[str] = Field(None, max_length=100)
|
|
completed_by: Optional[str] = Field(None, description="Session or user completing the item", max_length=100)
|
|
|
|
|
|
class CoordTodoResponse(BaseModel):
|
|
"""Output schema for a to-do item."""
|
|
|
|
id: UUID
|
|
text: str
|
|
project_key: Optional[str]
|
|
parent_id: Optional[UUID]
|
|
assigned_to_user: Optional[str]
|
|
assigned_to_machine: Optional[str]
|
|
auto_created: bool
|
|
source_context: Optional[str]
|
|
status: str
|
|
completed_at: Optional[datetime]
|
|
completed_by: Optional[str]
|
|
created_by_user: str
|
|
created_by_machine: str
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
subtasks: list[CoordTodoResponse] = Field(default_factory=list)
|
|
|
|
model_config = {"from_attributes": True}
|