enforce membership feature access in api and surface plans in admin
This commit is contained in:
1 parent
1f4800c055
commit
ebfd633a11
14 files changed
+573
-5
No files matched your search
@@ -18,6 +18,35 @@ export type GymStatus = (typeof GYM_STATUSES)[number];
|
||||
export const MEMBERSHIP_TYPES = ["basic", "premium", "vip"] as const;
|
||||
export type MembershipType = (typeof MEMBERSHIP_TYPES)[number];
|
||||
|
||||
export const MEMBERSHIP_FEATURES = {
|
||||
basic: {
|
||||
recommendationsPerMonth: 1,
|
||||
hydrationTracking: false,
|
||||
nutritionTracking: false,
|
||||
advancedStatistics: false,
|
||||
},
|
||||
premium: {
|
||||
recommendationsPerMonth: -1,
|
||||
hydrationTracking: true,
|
||||
nutritionTracking: true,
|
||||
advancedStatistics: true,
|
||||
},
|
||||
vip: {
|
||||
recommendationsPerMonth: -1,
|
||||
hydrationTracking: true,
|
||||
nutritionTracking: true,
|
||||
advancedStatistics: true,
|
||||
},
|
||||
} as const;
|
||||
|
||||
export type MembershipFeatures = (typeof MEMBERSHIP_FEATURES)[MembershipType];
|
||||
|
||||
export function getMembershipFeatures(
|
||||
membershipType: MembershipType,
|
||||
): MembershipFeatures {
|
||||
return MEMBERSHIP_FEATURES[membershipType];
|
||||
}
|
||||
|
||||
// Membership Statuses
|
||||
export const MEMBERSHIP_STATUSES = ["active", "inactive", "suspended"] as const;
|
||||
export type MembershipStatus = (typeof MEMBERSHIP_STATUSES)[number];
|
||||
|
||||
Reference in new issue
Block a user