Added the ProjectPlan interface to the Project.ts
This commit is contained in:
parent
305c72814c
commit
bd6e5f4fd6
@ -2,6 +2,10 @@ import { model, ObjectId, Schema } from "mongoose";
|
||||
import crypto from "crypto";
|
||||
import { fieldEncryption } from "mongoose-field-encryption";
|
||||
|
||||
export enum IProjectPlan {
|
||||
PERSONAL = "personal", PLUS = "plus", PRO = "pro"
|
||||
}
|
||||
|
||||
export interface IProjectDefaults {
|
||||
licenseKey: string,
|
||||
groups: string[],
|
||||
@ -14,7 +18,8 @@ export interface IProject {
|
||||
name: string,
|
||||
creatorId: ObjectId,
|
||||
validationKey: string,
|
||||
defaults: IProjectDefaults
|
||||
defaults: IProjectDefaults,
|
||||
plan: IProjectPlan
|
||||
}
|
||||
|
||||
const ProjectSchema = new Schema<IProject>({
|
||||
@ -34,10 +39,14 @@ const ProjectSchema = new Schema<IProject>({
|
||||
type: Object,
|
||||
default: { licenseKey: "NNUN-UUNN-UNAU-NAAN", groups: [], expirationDate: new Date(0), permissions: [] },
|
||||
},
|
||||
plan: {
|
||||
type: String,
|
||||
default: IProjectPlan.PERSONAL
|
||||
}
|
||||
});
|
||||
|
||||
ProjectSchema.plugin(fieldEncryption, {
|
||||
fields: ["name", "creatorId", "validationKey", "defaults"],
|
||||
fields: ["name", "creatorId", "validationKey", "defaults", "plan"],
|
||||
secret: process.env.ENC_KEY,
|
||||
saltGenerator: () => process.env.SIG_KEY
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user