entitlementsBE

This commit is contained in:
Alex Holliday committed 2025-11-28 21:31:44 +00:00
1 parent 86ce30b5f4
commit c43241eb52
13 files changed
+319 -5

No files matched your search

+65
View File
@@ -0,0 +1,65 @@
export type PlanKey = "free" | "pro" | "business" | "enterprise" | "unlimited";
export interface Entitlements {
plan: PlanKey;
monitorsMax: number;
notificationChannelsMax: number;
statusPageMax: number;
checksIntervalMsMin: number;
teamsMax: number;
notificationsEnabled: boolean;
retentionDays: number;
}
export const Plans: Record<PlanKey, Entitlements> = {
free: {
plan: "free",
monitorsMax: 5,
notificationChannelsMax: 2,
statusPageMax: 2,
checksIntervalMsMin: 60_000,
teamsMax: 2,
notificationsEnabled: true,
retentionDays: 30,
},
pro: {
plan: "pro",
monitorsMax: 50,
notificationChannelsMax: 5,
statusPageMax: 5,
checksIntervalMsMin: 30_000,
teamsMax: 5,
notificationsEnabled: true,
retentionDays: 90,
},
business: {
plan: "business",
monitorsMax: 200,
notificationChannelsMax: 20,
statusPageMax: 20,
checksIntervalMsMin: 15_000,
teamsMax: 10,
notificationsEnabled: true,
retentionDays: 180,
},
enterprise: {
plan: "enterprise",
monitorsMax: 5000,
notificationChannelsMax: 100,
statusPageMax: 100,
checksIntervalMsMin: 10_000,
teamsMax: 20,
notificationsEnabled: true,
retentionDays: 365,
},
unlimited: {
plan: "unlimited",
monitorsMax: Number.MAX_SAFE_INTEGER,
notificationChannelsMax: Number.MAX_SAFE_INTEGER,
statusPageMax: Number.MAX_SAFE_INTEGER,
checksIntervalMsMin: 1000,
teamsMax: Number.MAX_SAFE_INTEGER,
notificationsEnabled: true,
retentionDays: 365,
},
};
+3 -2
View File
@@ -1,11 +1,12 @@
import { IUserContext } from "../db/models/index.ts";
import { IUserContext } from "@/db/models/index.ts";
import type { Entitlements } from "@/types/entitlements.ts";
declare global {
namespace Express {
interface Request {
user?: IUserContext;
resource?: any;
validatedQuery: Record<string, any>;
entitlements?: Entitlements;
}
}
}