Updated the License.ts model

This commit is contained in:
Mathias Wagner 2023-08-03 22:53:40 +02:00
parent 8a8ce09c0d
commit 270c92551a
Signed by: Mathias
GPG Key ID: B8DC354B0A1F5B44

View File

@ -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<ILicense>({
projectId: {
type: Types.ObjectId,
type: String,
required: true
},
key: {
@ -32,7 +25,10 @@ const LicenseSchema = new Schema<ILicense>({
},
groups: [String],
permissions: [String],
meta: [Array],
meta: {
type: Object,
default: {}
},
maxUses: {
type: Number,
default: -1
@ -42,7 +38,7 @@ const LicenseSchema = new Schema<ILicense>({
default: 0
},
expirationDate: {
type: Date,
type: String,
default: Date.now
}
});