Skip to content

Issue #74 — Backend: Member Dashboard Provider #652

@yusuftomilola

Description

@yusuftomilola

Location: backend/src/dashboard/providers/member-dashboard.provider.ts

Description

Members need a personal dashboard summary — a snapshot of their own activity on the platform. This provider computes four headline stats for the member and bundles them with their five most recent bookings and five most recent payments in a single parallel query, so the member dashboard page can load everything in one API call.

Acceptance Criteria

  • A MemberDashboardProvider class is created at backend/src/dashboard/providers/member-dashboard.provider.ts with @InjectRepository decorators for Booking, Payment, and Invoice
  • A getMemberStats(userId: string) method that returns:
    • activeBookings — count of the member's bookings with status PENDING or CONFIRMED
    • totalSpentKobo — sum of amountKobo across the member's SUCCESS payments
    • invoiceCount — total count of the member's invoices
    • lastCheckIn — the checkedInAt timestamp of the member's most recent WorkspaceLog record, or null if none
  • A getMemberDashboard(userId: string) method that calls getMemberStats, fetches the member's 5 most recent bookings (with workspace relation), and fetches the member's 5 most recent SUCCESS payments — all via Promise.all — and returns:
    {
      stats: { activeBookings, totalSpentKobo, invoiceCount, lastCheckIn },
      recentBookings: Booking[],
      recentPayments: Payment[]
    }
    
  • MemberDashboardProvider is registered in DashboardModule
  • npx tsc --noEmit passes with no errors

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions