Created the License.ts model

This commit is contained in:
Mathias Wagner 2023-01-14 23:15:45 +01:00
parent 6909c13225
commit 19799a7431
Signed by: Mathias
GPG Key ID: B8DC354B0A1F5B44

41
src/models/License.ts Normal file
View File

@ -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<ILicense>({
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<ILicense>("licenses", LicenseSchema);