Created the License.ts model
This commit is contained in:
parent
6909c13225
commit
19799a7431
41
src/models/License.ts
Normal file
41
src/models/License.ts
Normal 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);
|
Loading…
x
Reference in New Issue
Block a user