From 270c92551af4f2790ffb0539e4e03d460a1e24a0 Mon Sep 17 00:00:00 2001 From: Mathias Wagner Date: Thu, 3 Aug 2023 22:53:40 +0200 Subject: [PATCH] Updated the License.ts model --- src/models/License.ts | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/models/License.ts b/src/models/License.ts index c83f945..2f56f8d 100644 --- a/src/models/License.ts +++ b/src/models/License.ts @@ -1,13 +1,6 @@ -import {model, ObjectId, Schema, Types} from "mongoose"; +import {model, ObjectId, Schema} from "mongoose"; import { fieldEncryption } from "mongoose-field-encryption"; import process from "process"; -import { ILicenseMetaType } from "@models/MetaData"; - -export interface ILicenseMeta { - type: ILicenseMetaType, - key: string, - value: string -} export interface ILicense { _id: ObjectId, @@ -15,7 +8,7 @@ export interface ILicense { key: string, groups?: string[], permissions?: string[], - meta?: ILicenseMeta[], + meta: { [key: string]: string }, maxUses: number, currentUses: number, expirationDate?: Date @@ -23,7 +16,7 @@ export interface ILicense { const LicenseSchema = new Schema({ projectId: { - type: Types.ObjectId, + type: String, required: true }, key: { @@ -32,7 +25,10 @@ const LicenseSchema = new Schema({ }, groups: [String], permissions: [String], - meta: [Array], + meta: { + type: Object, + default: {} + }, maxUses: { type: Number, default: -1 @@ -42,7 +38,7 @@ const LicenseSchema = new Schema({ default: 0 }, expirationDate: { - type: Date, + type: String, default: Date.now } });