feat: implement automation module
- Event-based triggers (Phase 1): - Trigger/TriggerLog models with field_change type - TriggerService for condition evaluation and action execution - Trigger CRUD API endpoints - Task integration (status, assignee, priority changes) - Frontend: TriggerList, TriggerForm components - Weekly reports (Phase 2): - ScheduledReport/ReportHistory models - ReportService for stats generation - APScheduler for Friday 16:00 job - Report preview/generate/history API - Frontend: WeeklyReportPreview, ReportHistory components - Tests: 23 new tests (14 triggers + 9 reports) - OpenSpec: add-automation change archived 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
50
backend/app/schemas/report.py
Normal file
50
backend/app/schemas/report.py
Normal file
@@ -0,0 +1,50 @@
|
||||
from datetime import datetime
|
||||
from typing import Optional, List, Dict, Any
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class ProjectSummary(BaseModel):
|
||||
project_id: str
|
||||
project_title: str
|
||||
completed_count: int
|
||||
in_progress_count: int
|
||||
overdue_count: int
|
||||
total_tasks: int
|
||||
|
||||
|
||||
class ReportSummary(BaseModel):
|
||||
completed_count: int
|
||||
in_progress_count: int
|
||||
overdue_count: int
|
||||
total_tasks: int
|
||||
|
||||
|
||||
class WeeklyReportContent(BaseModel):
|
||||
week_start: str
|
||||
week_end: str
|
||||
generated_at: str
|
||||
projects: List[Dict[str, Any]]
|
||||
summary: ReportSummary
|
||||
|
||||
|
||||
class ReportHistoryItem(BaseModel):
|
||||
id: str
|
||||
report_id: str
|
||||
generated_at: datetime
|
||||
content: Dict[str, Any]
|
||||
status: str
|
||||
error_message: Optional[str] = None
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class ReportHistoryListResponse(BaseModel):
|
||||
reports: List[ReportHistoryItem]
|
||||
total: int
|
||||
|
||||
|
||||
class GenerateReportResponse(BaseModel):
|
||||
message: str
|
||||
report_id: str
|
||||
summary: ReportSummary
|
||||
Reference in New Issue
Block a user