Updated the License.ts model
This commit is contained in:
parent
8a8ce09c0d
commit
270c92551a
@ -1,13 +1,6 @@
|
|||||||
import {model, ObjectId, Schema, Types} from "mongoose";
|
import {model, ObjectId, Schema} from "mongoose";
|
||||||
import { fieldEncryption } from "mongoose-field-encryption";
|
import { fieldEncryption } from "mongoose-field-encryption";
|
||||||
import process from "process";
|
import process from "process";
|
||||||
import { ILicenseMetaType } from "@models/MetaData";
|
|
||||||
|
|
||||||
export interface ILicenseMeta {
|
|
||||||
type: ILicenseMetaType,
|
|
||||||
key: string,
|
|
||||||
value: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ILicense {
|
export interface ILicense {
|
||||||
_id: ObjectId,
|
_id: ObjectId,
|
||||||
@ -15,7 +8,7 @@ export interface ILicense {
|
|||||||
key: string,
|
key: string,
|
||||||
groups?: string[],
|
groups?: string[],
|
||||||
permissions?: string[],
|
permissions?: string[],
|
||||||
meta?: ILicenseMeta[],
|
meta: { [key: string]: string },
|
||||||
maxUses: number,
|
maxUses: number,
|
||||||
currentUses: number,
|
currentUses: number,
|
||||||
expirationDate?: Date
|
expirationDate?: Date
|
||||||
@ -23,7 +16,7 @@ export interface ILicense {
|
|||||||
|
|
||||||
const LicenseSchema = new Schema<ILicense>({
|
const LicenseSchema = new Schema<ILicense>({
|
||||||
projectId: {
|
projectId: {
|
||||||
type: Types.ObjectId,
|
type: String,
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
key: {
|
key: {
|
||||||
@ -32,7 +25,10 @@ const LicenseSchema = new Schema<ILicense>({
|
|||||||
},
|
},
|
||||||
groups: [String],
|
groups: [String],
|
||||||
permissions: [String],
|
permissions: [String],
|
||||||
meta: [Array],
|
meta: {
|
||||||
|
type: Object,
|
||||||
|
default: {}
|
||||||
|
},
|
||||||
maxUses: {
|
maxUses: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: -1
|
default: -1
|
||||||
@ -42,7 +38,7 @@ const LicenseSchema = new Schema<ILicense>({
|
|||||||
default: 0
|
default: 0
|
||||||
},
|
},
|
||||||
expirationDate: {
|
expirationDate: {
|
||||||
type: Date,
|
type: String,
|
||||||
default: Date.now
|
default: Date.now
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user