Files
PROJECT-CONTORL/backend/app/schemas/project_health.py
beabigegg 55f85d0d3c feat: implement soft delete, task editing fixes, and UI improvements
Backend:
- Add soft delete for spaces and projects (is_active flag)
- Add status_id and assignee_id to TaskUpdate schema
- Fix task PATCH endpoint to update status and assignee
- Add validation for assignee_id and status_id in task updates
- Fix health service to count tasks with "Blocked" status as blockers
- Filter out deleted spaces/projects from health dashboard
- Add workload cache invalidation on assignee changes

Frontend:
- Add delete confirmation dialogs for spaces and projects
- Fix UserSelect to display selected user name (valueName prop)
- Fix task detail modal to refresh data after save
- Enforce 2-level subtask depth limit in UI
- Fix timezone bug in date formatting (use local timezone)
- Convert NotificationBell from Tailwind to inline styles
- Add i18n translations for health, workload, settings pages
- Add parent_task_id to Task interface across components

OpenSpec:
- Archive add-delete-capability change

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 01:32:13 +08:00

70 lines
1.7 KiB
Python

from pydantic import BaseModel
from typing import Optional, List
from datetime import datetime
from enum import Enum
class RiskLevel(str, Enum):
LOW = "low"
MEDIUM = "medium"
HIGH = "high"
CRITICAL = "critical"
class ScheduleStatus(str, Enum):
ON_TRACK = "on_track"
AT_RISK = "at_risk"
DELAYED = "delayed"
class ResourceStatus(str, Enum):
ADEQUATE = "adequate"
CONSTRAINED = "constrained"
OVERLOADED = "overloaded"
class ProjectHealthBase(BaseModel):
health_score: int
risk_level: RiskLevel
schedule_status: ScheduleStatus
resource_status: ResourceStatus
class ProjectHealthResponse(ProjectHealthBase):
id: str
project_id: str
last_updated: datetime
class Config:
from_attributes = True
class ProjectHealthWithDetails(ProjectHealthResponse):
"""Extended health response with project and computed metrics."""
project_title: str
project_status: str
owner_name: Optional[str] = None
space_name: Optional[str] = None
task_count: int = 0
completed_task_count: int = 0
blocker_count: int = 0
overdue_task_count: int = 0
class ProjectHealthSummary(BaseModel):
"""Aggregated health metrics across all projects."""
total_projects: int
healthy_count: int # health_score >= 80 (low risk)
at_risk_count: int # health_score 60-79 (medium risk)
high_risk_count: int # health_score 40-59 (high risk)
critical_count: int # health_score < 40 (critical risk)
average_health_score: float
projects_with_blockers: int
projects_delayed: int
class ProjectHealthDashboardResponse(BaseModel):
"""Full dashboard response with project list and summary."""
projects: List[ProjectHealthWithDetails]
summary: ProjectHealthSummary