feat(reports): capacity-based utilization + report CSVs

Utilization now measures booked minutes against each member's
availability-rule capacity in the tenant timezone, replacing the
confirmed-share proxy. StaffMetric exposes booked/capacity minutes.

New endpoints: GET /v1/export/staff-report.csv (reuses StaffMetrics)
and GET /v1/export/service-report.csv (per-service bookings/cancelled/
revenue, class bookings rolled up). Export buttons on the staff
performance panel and services page.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
Tomas DvorakandDevin committed 2026-09-18 17:10:15 +02:00
1 parent 2464aa45fa
commit 7b9080eb1c
13 files changed
+541 -33

No files matched your search

+4
View File
@@ -560,12 +560,16 @@ type ActivityFeedResponse struct {
// StaffMetric aggregates appointment workload for one staff member over a
// trailing window. Class bookings carry no staff assignment and are excluded.
// UtilizationPercent is bookedMinutes / capacityMinutes — booked time against
// the member's availability-rule capacity in the tenant timezone.
type StaffMetric struct {
StaffID string `json:"staffId"`
DisplayName string `json:"displayName"`
Bookings int `json:"bookings"`
Completed int `json:"completed"`
Cancelled int `json:"cancelled"`
BookedMinutes int `json:"bookedMinutes"`
CapacityMinutes int `json:"capacityMinutes"`
UtilizationPercent int `json:"utilizationPercent"`
RevenueCents int64 `json:"revenueCents"`
}