Skip to content

feat: implement subscription web dashboard with admin controls (#215)#329

Merged
Smartdevs17 merged 1 commit into
Smartdevs17:mainfrom
Itodo-S:issue-215-admin-dashboard
Apr 26, 2026
Merged

feat: implement subscription web dashboard with admin controls (#215)#329
Smartdevs17 merged 1 commit into
Smartdevs17:mainfrom
Itodo-S:issue-215-admin-dashboard

Conversation

@Itodo-S
Copy link
Copy Markdown
Contributor

@Itodo-S Itodo-S commented Apr 26, 2026

Summary

Closes #215 — extends the admin dashboard service with audit log filtering and comprehensive test coverage.

Changes

src/services/adminDashboardService.ts

  • Added filterAuditLog(log, filter) — filters the audit event log by any combination of resourceType, action, and actorId (all criteria are AND-ed)
  • Exported AuditLogFilter interface

src/services/__tests__/adminDashboardService.test.ts

  • Expanded from 4 to 25+ test cases covering all RBAC operations:
    • getAdminDashboardData — shape, immutability
    • toggleMerchantStatus — admin suspends/activates, non-admin blocked, no mutation
    • upsertSubscription — role gating (admin/analyst can create, support cannot)
    • cycleSubscriptionStatus — all status transitions, support blocked
    • deleteSubscription — admin removes, non-admin blocked
    • bulkUpdateSubscriptions — selective pause, support blocked, empty selection
    • updateUserRole — role cycling (viewer→analyst→support→viewer), non-admin blocked
    • filterAuditLog — filter by resourceType/action/actorId, multi-criteria AND, empty filter, no-match

Acceptance criteria coverage

  • Merchant management interface — toggleMerchantStatus RBAC
  • Subscription CRUD operations — create, cycle status, delete, bulk update
  • Analytics and reporting — getAdminDashboardData returns analytics snapshot
  • Implement bulk operations — bulkUpdateSubscriptions
  • User management — updateUserRole with role cycling
  • Implement audit logging — filterAuditLog for drill-down queries
  • Role-based access for dashboard — all operations gated by DashboardRole

Test plan

  • jest --testPathPattern=adminDashboardService — all tests pass

@Smartdevs17 Smartdevs17 merged commit f55e1be into Smartdevs17:main Apr 26, 2026
3 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement subscription web dashboard with admin controls

2 participants