Backend Changes: - Add estimated_minutes field to tasks (stored as integer minutes) - Add tags field (JSON array) for categorizing tasks - Add flag_color field for visual priority indicators - Add search endpoint (/api/search) with project filtering - Update JSON import to handle new metadata fields Frontend Changes: - Display version v0.1.3 in header - Add search API client function - Add format utility for time display (30m, 1.5h, etc.) Example Data: - Update example-import.json with time estimates, tags, and flags - Demonstrate nested metadata inheritance Note: Frontend UI for displaying/editing these fields in progress
103 lines
2.2 KiB
Python
103 lines
2.2 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
|
|
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[TaskStatus] = 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)
|
|
|
|
|
|
# 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
|
|
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
|
|
|
|
|
|
class ImportData(BaseModel):
|
|
project: ImportProject
|
|
tasks: List[ImportSubtask] = []
|
|
|
|
|
|
class ImportResult(BaseModel):
|
|
project_id: int
|
|
project_name: str
|
|
tasks_created: int
|