This commit implements a fully functional self-hosted task decomposition engine with: Backend (FastAPI + SQLite): - RESTful API with full CRUD operations for projects and tasks - Arbitrary-depth hierarchical task structure using self-referencing parent_task_id - JSON import endpoint for seeding projects from LLM-generated breakdowns - SQLAlchemy models with proper relationships and cascade deletes - Status tracking (backlog, in_progress, blocked, done) - Auto-generated OpenAPI documentation Frontend (React + Vite + Tailwind): - Dark cyberpunk theme with orange accents - Project list page with create/import/delete functionality - Dual view modes: * Tree View: Collapsible hierarchical display with inline editing * Kanban Board: Drag-and-drop status management - Real-time CRUD operations for tasks and subtasks - JSON import modal with validation - Responsive design optimized for desktop Infrastructure: - Docker setup with multi-stage builds - docker-compose for orchestration - Nginx reverse proxy for production frontend - Named volume for SQLite persistence - CORS configuration for local development Documentation: - Comprehensive README with setup instructions - Example JSON import file demonstrating nested structure - API endpoint documentation - Data model diagrams
94 lines
1.8 KiB
Python
94 lines
1.8 KiB
Python
from pydantic import BaseModel, ConfigDict
|
|
from typing import Optional, List
|
|
from datetime import datetime
|
|
from .models import TaskStatus
|
|
|
|
|
|
# Task Schemas
|
|
class TaskBase(BaseModel):
|
|
title: str
|
|
description: Optional[str] = None
|
|
status: TaskStatus = TaskStatus.BACKLOG
|
|
parent_task_id: Optional[int] = None
|
|
sort_order: int = 0
|
|
|
|
|
|
class TaskCreate(TaskBase):
|
|
project_id: int
|
|
|
|
|
|
class TaskUpdate(BaseModel):
|
|
title: Optional[str] = None
|
|
description: Optional[str] = None
|
|
status: Optional[TaskStatus] = None
|
|
parent_task_id: Optional[int] = None
|
|
sort_order: Optional[int] = 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)
|
|
|
|
|
|
# Project Schemas
|
|
class ProjectBase(BaseModel):
|
|
name: str
|
|
description: Optional[str] = None
|
|
|
|
|
|
class ProjectCreate(ProjectBase):
|
|
pass
|
|
|
|
|
|
class ProjectUpdate(BaseModel):
|
|
name: Optional[str] = None
|
|
description: Optional[str] = None
|
|
|
|
|
|
class Project(ProjectBase):
|
|
id: int
|
|
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: TaskStatus = TaskStatus.BACKLOG
|
|
subtasks: List['ImportSubtask'] = []
|
|
|
|
|
|
class ImportProject(BaseModel):
|
|
name: str
|
|
description: Optional[str] = None
|
|
|
|
|
|
class ImportData(BaseModel):
|
|
project: ImportProject
|
|
tasks: List[ImportSubtask] = []
|
|
|
|
|
|
class ImportResult(BaseModel):
|
|
project_id: int
|
|
project_name: str
|
|
tasks_created: int
|