From 19799a74313758f4b21a3a644e42e3a531d51b8d Mon Sep 17 00:00:00 2001 From: Mathias Wagner Date: Sat, 14 Jan 2023 23:15:45 +0100 Subject: [PATCH] Created the License.ts model --- src/models/License.ts | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 src/models/License.ts diff --git a/src/models/License.ts b/src/models/License.ts new file mode 100644 index 0000000..a0c1a33 --- /dev/null +++ b/src/models/License.ts @@ -0,0 +1,41 @@ +import {model, ObjectId, Schema, Types} from "mongoose"; + +export enum ILicenseMetaType { + STRING +} + +export interface ILicenseMeta { + type: ILicenseMetaType, + key: string, + value: string +} + +export interface ILicense { + id: ObjectId, + projectId: ObjectId, + key: string, + groups?: string[], + permissions?: string[], + meta?: ILicenseMeta[], + expirationDate?: Date +} + +const LicenseSchema = new Schema({ + projectId: { + type: Types.ObjectId, + required: true + }, + key: { + type: String, + required: true + }, + groups: [String], + permissions: [String], + meta: [Array], + expirationDate: { + type: Date, + default: Date.now + } +}); + +export const Account = model("licenses", LicenseSchema); \ No newline at end of file