- New task_blockers join table (many-to-many, cross-project)
- Cycle detection prevents circular dependencies
- GET /api/tasks/{id}/blockers and /blocking endpoints
- POST/DELETE /api/tasks/{id}/blockers/{blocker_id}
- GET /api/actionable — all non-done tasks with no incomplete blockers
- BlockerPanel.jsx — search & manage blockers per task (via task menu)
- ActionableView.jsx — "what can I do right now?" dashboard grouped by project
- "Now" button in nav header routes to actionable view
- migrate_add_blockers.py migration script for existing databases
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
139 lines
3.2 KiB
Python
139 lines
3.2 KiB
Python
from pydantic import BaseModel, ConfigDict
|
|
from typing import Optional, List
|
|
from datetime import datetime
|
|
from .models import DEFAULT_STATUSES
|
|
|
|
|
|
# Task Schemas
|
|
class TaskBase(BaseModel):
|
|
title: str
|
|
description: Optional[str] = None
|
|
status: str = "backlog"
|
|
parent_task_id: Optional[int] = None
|
|
sort_order: int = 0
|
|
estimated_minutes: Optional[int] = None
|
|
tags: Optional[List[str]] = None
|
|
flag_color: Optional[str] = None
|
|
|
|
|
|
class TaskCreate(TaskBase):
|
|
project_id: int
|
|
|
|
|
|
class TaskUpdate(BaseModel):
|
|
title: Optional[str] = None
|
|
description: Optional[str] = None
|
|
status: Optional[str] = None
|
|
parent_task_id: Optional[int] = None
|
|
sort_order: Optional[int] = None
|
|
estimated_minutes: Optional[int] = None
|
|
tags: Optional[List[str]] = None
|
|
flag_color: Optional[str] = None
|
|
|
|
|
|
class Task(TaskBase):
|
|
id: int
|
|
project_id: int
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
|
|
class TaskWithSubtasks(Task):
|
|
subtasks: List['TaskWithSubtasks'] = []
|
|
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
|
|
class BlockerInfo(BaseModel):
|
|
"""Lightweight task info used when listing blockers/blocking relationships."""
|
|
id: int
|
|
title: str
|
|
project_id: int
|
|
status: str
|
|
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
|
|
class TaskWithBlockers(Task):
|
|
blockers: List[BlockerInfo] = []
|
|
blocking: List[BlockerInfo] = []
|
|
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
|
|
class ActionableTask(BaseModel):
|
|
"""A task that is ready to work on — not done, and all blockers are resolved."""
|
|
id: int
|
|
title: str
|
|
project_id: int
|
|
project_name: str
|
|
status: str
|
|
estimated_minutes: Optional[int] = None
|
|
tags: Optional[List[str]] = None
|
|
flag_color: Optional[str] = None
|
|
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
|
|
# Project Schemas
|
|
class ProjectBase(BaseModel):
|
|
name: str
|
|
description: Optional[str] = None
|
|
|
|
|
|
class ProjectCreate(ProjectBase):
|
|
statuses: Optional[List[str]] = None
|
|
|
|
|
|
class ProjectUpdate(BaseModel):
|
|
name: Optional[str] = None
|
|
description: Optional[str] = None
|
|
statuses: Optional[List[str]] = None
|
|
is_archived: Optional[bool] = None
|
|
|
|
|
|
class Project(ProjectBase):
|
|
id: int
|
|
statuses: List[str]
|
|
is_archived: bool
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
|
|
class ProjectWithTasks(Project):
|
|
tasks: List[Task] = []
|
|
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
|
|
# JSON Import Schemas
|
|
class ImportSubtask(BaseModel):
|
|
title: str
|
|
description: Optional[str] = None
|
|
status: str = "backlog"
|
|
estimated_minutes: Optional[int] = None
|
|
tags: Optional[List[str]] = None
|
|
flag_color: Optional[str] = None
|
|
subtasks: List['ImportSubtask'] = []
|
|
|
|
|
|
class ImportProject(BaseModel):
|
|
name: str
|
|
description: Optional[str] = None
|
|
statuses: Optional[List[str]] = None
|
|
|
|
|
|
class ImportData(BaseModel):
|
|
project: ImportProject
|
|
tasks: List[ImportSubtask] = []
|
|
|
|
|
|
class ImportResult(BaseModel):
|
|
project_id: int
|
|
project_name: str
|
|
tasks_created: int
|