Skip to content

feat(subscription): add subscription benefit plan management#1012

Open
Glorhop wants to merge 2 commits intoWei-Shaw:mainfrom
Glorhop:pr/subscription-benefit-plan
Open

feat(subscription): add subscription benefit plan management#1012
Glorhop wants to merge 2 commits intoWei-Shaw:mainfrom
Glorhop:pr/subscription-benefit-plan

Conversation

@Glorhop
Copy link

@Glorhop Glorhop commented Mar 14, 2026

📝 Background

This PR introduces a benefit-plan based subscription management model designed to improve admin-side operational efficiency and ensure data consistency across the platform.

🚀 What’s Included

1. Core Domain Models

  • Benefit Package: Reusable package grouping specific permissions/groups and lease durations.
  • Benefit Plan: A higher-level model composed of multiple benefit packages.
  • User-Plan Assignment: Tracks active plan status per user (strictly one active plan per user).
  • Database Schema: Migration tables and optimized indexes for the new models.

2. Admin APIs & Logic

  • CRUD Operations: Full management endpoints for Benefit Packages and Benefit Plans.
  • Membership Management:
    • List members of a specific plan.
    • Bulk assign/remove users to/from a plan.
    • Individual user plan assignment (get/set).
  • Reconciliation: Automated subscription reconciliation flow triggered after plan or package updates.
  • Cache Integrity: Cache invalidation hooks to ensure affected users/groups receive real-time updates.

3. Frontend Integration

  • Updated API clients to support new subscription endpoints.
  • New TypeScript types and i18n localization strings.
  • Enhanced subscription admin views for better UX.

✨ Why This Is Good

  • Scalability: Transitions from manual, per-user group assignments to efficient, plan-based operations.
  • Efficiency: Supports batch operations for managing large user sets simultaneously.
  • Data Integrity: Uses transaction-oriented update/reconcile flows to prevent state drift.
  • Maintainability: Clearer domain modeling (package -> plan -> assignment) simplifies future enhancements.

🧪 Validation

  • Backend: All service/handler unit tests passed in local verification.
  • Frontend: Production build (npm run build) passed with no type errors.
  • Manual Test: Verified bulk assignment and automatic reconciliation in the admin dashboard.

@Glorhop Glorhop force-pushed the pr/subscription-benefit-plan branch from 7650a35 to 557e310 Compare March 19, 2026 04:57
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.

2 participants