feat: implement audit trail alignment (soft delete & permission audit)
- Task Soft Delete:
- Add is_deleted, deleted_at, deleted_by fields to Task model
- Convert DELETE to soft delete with cascade to subtasks
- Add include_deleted query param (admin only)
- Add POST /api/tasks/{id}/restore endpoint
- Exclude deleted tasks from subtask_count
- Permission Change Audit:
- Add user.role_change event (high sensitivity)
- Add user.admin_change event (critical, triggers alert)
- Add PATCH /api/users/{id}/admin endpoint
- Add role.permission_change event type
- Append-Only Enforcement:
- Add DB triggers for audit_logs immutability (manual for production)
- Migration 008 with graceful trigger failure handling
- Tests: 11 new soft delete tests (153 total passing)
- OpenSpec: fix-audit-trail archived, fix-realtime-notifications & fix-weekly-report proposals added
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
38
openspec/changes/fix-weekly-report/tasks.md
Normal file
38
openspec/changes/fix-weekly-report/tasks.md
Normal file
@@ -0,0 +1,38 @@
|
||||
## Phase 1: Backend Report Enhancement
|
||||
|
||||
### 1.1 ReportService 擴充
|
||||
- [ ] 1.1.1 移除 completed_tasks/overdue_tasks 的 5 筆限制
|
||||
- [ ] 1.1.2 新增 in_progress_tasks 完整清單
|
||||
- [ ] 1.1.3 新增 blocked_tasks 查詢與清單
|
||||
- [ ] 1.1.4 新增 next_week_tasks 查詢與清單
|
||||
- [ ] 1.1.5 擴充 summary 包含 blocked_count 與 next_week_count
|
||||
|
||||
### 1.2 任務明細欄位
|
||||
- [ ] 1.2.1 completed_tasks 加入 completed_at, assignee_name
|
||||
- [ ] 1.2.2 in_progress_tasks 加入 assignee_name, due_date
|
||||
- [ ] 1.2.3 overdue_tasks 加入 days_overdue 計算
|
||||
- [ ] 1.2.4 blocked_tasks 加入 blocker_reason, blocked_since
|
||||
- [ ] 1.2.5 next_week_tasks 加入 due_date, assignee_name
|
||||
|
||||
### 1.3 Testing - Phase 1
|
||||
- [ ] 1.3.1 週報內容結構測試
|
||||
- [ ] 1.3.2 阻礙任務查詢測試
|
||||
- [ ] 1.3.3 下週預計任務測試
|
||||
|
||||
## Phase 2: Frontend Display
|
||||
|
||||
### 2.1 WeeklyReportPreview 更新
|
||||
- [ ] 2.1.1 新增 BlockedTasksSection 元件
|
||||
- [ ] 2.1.2 新增 NextWeekTasksSection 元件
|
||||
- [ ] 2.1.3 更新 CompletedTasksSection 顯示完整清單
|
||||
- [ ] 2.1.4 更新 InProgressTasksSection 顯示完整清單
|
||||
- [ ] 2.1.5 更新 OverdueTasksSection 顯示 days_overdue
|
||||
|
||||
### 2.2 UI 改善
|
||||
- [ ] 2.2.1 可摺疊區塊設計
|
||||
- [ ] 2.2.2 任務項目樣式統一
|
||||
- [ ] 2.2.3 逾期/阻礙 highlight 樣式
|
||||
|
||||
### 2.3 Testing - Phase 2
|
||||
- [ ] 2.3.1 前端週報顯示測試
|
||||
- [ ] 2.3.2 空清單狀態測試
|
||||
Reference in New Issue
Block a user