Add honeycomb completion heatmap and data migration framework

- Add completion_summary endpoint data to residence detail response
- Track completed_from_column on task completions (overdue/due_soon/upcoming)
- Add GetCompletionSummary repo method with monthly aggregation
- Add one-time data migration framework (data_migrations table + registry)
- Add backfill migration to classify historical completions
- Add standalone backfill script for manual/dry-run usage

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Trey t
2026-03-12 00:05:10 -05:00
parent 739b245ee6
commit 6803f6ec18
12 changed files with 958 additions and 21 deletions

View File

@@ -48,9 +48,10 @@ type ResidenceResponse struct {
PurchasePrice *decimal.Decimal `json:"purchase_price"`
IsPrimary bool `json:"is_primary"`
IsActive bool `json:"is_active"`
OverdueCount int `json:"overdue_count"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
OverdueCount int `json:"overdue_count"`
CompletionSummary *CompletionSummary `json:"completion_summary,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
// TotalSummary represents summary statistics for all residences
@@ -114,6 +115,28 @@ type SharePackageResponse struct {
ExpiresAt *time.Time `json:"expires_at,omitempty"`
}
// ColumnCompletionCount represents completions from a specific kanban column
type ColumnCompletionCount struct {
Column string `json:"column"`
Color string `json:"color"`
Count int `json:"count"`
}
// MonthlyCompletionSummary represents completions for a single month
type MonthlyCompletionSummary struct {
Month string `json:"month"` // "2025-04" format
Completions []ColumnCompletionCount `json:"completions"`
Total int `json:"total"`
Overflow int `json:"overflow"` // completions beyond the display cap
}
// CompletionSummary represents task completion data for the honeycomb grid
type CompletionSummary struct {
TotalAllTime int `json:"total_all_time"`
TotalLast12Months int `json:"total_last_12_months"`
Months []MonthlyCompletionSummary `json:"months"`
}
// === Factory Functions ===
// NewResidenceUserResponse creates a ResidenceUserResponse from a User model