From bd6e5f4fd68e4dd6bdfff9e2d6bba5b2c5e3e708 Mon Sep 17 00:00:00 2001 From: Mathias Wagner Date: Sun, 22 Jan 2023 18:02:13 +0100 Subject: [PATCH] Added the ProjectPlan interface to the Project.ts --- src/models/Project.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/models/Project.ts b/src/models/Project.ts index c162f38..e57ff10 100644 --- a/src/models/Project.ts +++ b/src/models/Project.ts @@ -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({ @@ -34,10 +39,14 @@ const ProjectSchema = new Schema({ 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 });