protect routes and import function
This commit is contained in:
1 parent
e600f293b0
commit
f476a57748
12 files changed
+112
-28
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import { PlanKey } from "@/types/entitlements.js";
|
||||
import mongoose, { Schema, Document, Types } from "mongoose";
|
||||
export type SubscriptionStatus =
|
||||
| "active"
|
||||
@@ -25,10 +26,11 @@ export interface IOrg extends Document {
|
||||
cancelAtPeriodEnd?: boolean;
|
||||
|
||||
// Cached entitlements
|
||||
entitlements?: {
|
||||
entitlements: {
|
||||
plan: PlanKey;
|
||||
monitorsMax: number;
|
||||
notificationChannelsMax: number;
|
||||
statusPageMax: number;
|
||||
statusPagesMax: number;
|
||||
checksIntervalMsMin: number;
|
||||
teamsMax: number;
|
||||
notificationsEnabled: boolean;
|
||||
@@ -62,9 +64,10 @@ const orgSchema = new Schema<IOrg>(
|
||||
trialEnd: { type: Date },
|
||||
cancelAtPeriodEnd: { type: Boolean },
|
||||
entitlements: {
|
||||
plan: { type: String },
|
||||
monitorsMax: { type: Number },
|
||||
notificationChannelsMax: { type: Number },
|
||||
statusPageMax: { type: Number },
|
||||
statusPagesMax: { type: Number },
|
||||
checksIntervalMsMin: { type: Number },
|
||||
teamsMax: { type: Number },
|
||||
notificationsEnabled: { type: Boolean },
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import mongoose, { Schema, Document, Types } from "mongoose";
|
||||
import { IRole, ITeam } from "@/db/models/index.js";
|
||||
import { Entitlements } from "@/types/entitlements.js";
|
||||
|
||||
export interface ITokenizedUser {
|
||||
sub: string;
|
||||
@@ -17,6 +18,7 @@ export interface IUserContext {
|
||||
orgRole?: IRole;
|
||||
teamRole: IRole;
|
||||
};
|
||||
entitlements: Entitlements;
|
||||
}
|
||||
|
||||
export interface IUserReturnable {
|
||||
@@ -33,6 +35,7 @@ export interface IUserReturnable {
|
||||
name: string;
|
||||
permissions: string[];
|
||||
}[];
|
||||
entitlements: Entitlements;
|
||||
}
|
||||
|
||||
export interface IUser extends Document {
|
||||
|
||||
Reference in new issue
Block a user