-
Notifications
You must be signed in to change notification settings - Fork 134
Open
Labels
good first issueGood for newcomersGood for newcomers
Description
Location: backend/src/dashboard/providers/admin-analytics.provider.ts
Description
The second set of admin analytics covers booking activity and leaderboards. Booking stats are broken down by status so admins can see how many bookings are pending, confirmed, completed, or cancelled. Top workspaces are ranked by booking count and revenue. Top members are ranked by total payment amount. These are added as new methods on the same AdminAnalyticsProvider class from Issue #71.
Acceptance Criteria
-
@InjectRepositorydecorators forBookingandWorkspaceare added toAdminAnalyticsProvider(in addition to those from Issue CSV Export for Check-ins #71) - A
getBookingStats(from?: string, to?: string)method is implemented that returns:byStatus— aRecord<string, number>map of booking counts keyed byBookingStatus(e.g.{ PENDING: 4, CONFIRMED: 12, COMPLETED: 30, CANCELLED: 2 })trend— array of{ month: string, count: number }for the last 6 calendar months usingDATE_TRUNC('month', "createdAt"), ordered oldest to newest
- A
getTopWorkspaces(limit = 5, from?: string, to?: string)method is implemented that returns an array of up tolimitworkspaces ordered by booking count descending, each entry containing:id,name— from theWorkspaceentitybookings— raw SQLCOUNTresultrevenueKobo— raw SQLSUMofPayment.amountKobofor successful payments linked to that workspace's bookings
- A
getTopMembers(limit = 5, from?: string, to?: string)method is implemented that returns an array of up tolimitmembers ordered by total payment amount descending, each entry containing:id— user IDfullName— concatenatedfirstname || ' ' || lastnametotalKobo— raw SQLSUMofPayment.amountKobo
- All methods accept optional
from/todate range filters -
npx tsc --noEmitpasses with no errors
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomers