Updated the License.ts model
This commit is contained in:
parent
f77ff6f03f
commit
69b5c129b7
@ -19,6 +19,8 @@ export interface ILicense {
|
|||||||
groups?: string[],
|
groups?: string[],
|
||||||
permissions?: string[],
|
permissions?: string[],
|
||||||
meta?: ILicenseMeta[],
|
meta?: ILicenseMeta[],
|
||||||
|
maxUses: number,
|
||||||
|
currentUses: number,
|
||||||
expirationDate?: Date
|
expirationDate?: Date
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,6 +36,14 @@ const LicenseSchema = new Schema<ILicense>({
|
|||||||
groups: [String],
|
groups: [String],
|
||||||
permissions: [String],
|
permissions: [String],
|
||||||
meta: [Array],
|
meta: [Array],
|
||||||
|
maxUses: {
|
||||||
|
type: Number,
|
||||||
|
default: -1
|
||||||
|
},
|
||||||
|
currentUses: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
expirationDate: {
|
expirationDate: {
|
||||||
type: Date,
|
type: Date,
|
||||||
default: Date.now
|
default: Date.now
|
||||||
@ -41,7 +51,7 @@ const LicenseSchema = new Schema<ILicense>({
|
|||||||
});
|
});
|
||||||
|
|
||||||
LicenseSchema.plugin(fieldEncryption, {
|
LicenseSchema.plugin(fieldEncryption, {
|
||||||
fields: ["projectId", "key", "groups", "permissions", "meta", "expirationDate"],
|
fields: ["projectId", "key", "groups", "permissions", "meta", "maxUses", "currentUses", "expirationDate"],
|
||||||
secret: process.env.ENC_KEY,
|
secret: process.env.ENC_KEY,
|
||||||
saltGenerator: () => process.env.SIG_KEY
|
saltGenerator: () => process.env.SIG_KEY
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user