feat: add dashboard aggregation endpoint (Phase 2I)
GET /api/dashboard returns aggregated data: - deadline_summary: overdue, due this/next week, ok counts - case_summary: active, new this month, closed counts - upcoming_deadlines: next 7 days with case info - upcoming_appointments: next 7 days - recent_activity: last 10 case events Uses efficient CTE query for summaries. Also fixes duplicate writeJSON/writeError declarations in appointments handler.
This commit is contained in:
@@ -203,14 +203,3 @@ func (h *AppointmentHandler) Delete(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusNoContent)
|
||||
}
|
||||
|
||||
func writeJSON(w http.ResponseWriter, status int, v any) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(status)
|
||||
json.NewEncoder(w).Encode(v)
|
||||
}
|
||||
|
||||
func writeError(w http.ResponseWriter, status int, msg string) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(status)
|
||||
json.NewEncoder(w).Encode(map[string]string{"error": msg})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user