Updated the MetaData.ts model
This commit is contained in:
parent
a43f407393
commit
d9fd88ad23
@ -1,8 +1,15 @@
|
|||||||
import { model, Schema } from "mongoose";
|
import { model, Schema } from "mongoose";
|
||||||
|
import { fieldEncryption } from "mongoose-field-encryption";
|
||||||
|
|
||||||
|
export enum ILicenseMetaType {
|
||||||
|
TEXT = "TEXT",
|
||||||
|
NUMBER = "NUMBER",
|
||||||
|
BOOLEAN = "BOOLEAN"
|
||||||
|
}
|
||||||
|
|
||||||
export interface IMetaData {
|
export interface IMetaData {
|
||||||
projectId: string,
|
projectId: string,
|
||||||
type: string,
|
type: ILicenseMetaType,
|
||||||
name: string,
|
name: string,
|
||||||
description?: string,
|
description?: string,
|
||||||
defaultValue?: string,
|
defaultValue?: string,
|
||||||
@ -22,7 +29,10 @@ const MetaDataSchema = new Schema<IMetaData>({
|
|||||||
type: String,
|
type: String,
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
description: String,
|
description: {
|
||||||
|
type: String,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
defaultValue: String,
|
defaultValue: String,
|
||||||
public: {
|
public: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
@ -30,4 +40,10 @@ const MetaDataSchema = new Schema<IMetaData>({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export const MetaData = model<IMetaData>("MetaData", MetaDataSchema);
|
MetaDataSchema.plugin(fieldEncryption, {
|
||||||
|
fields: ["projectId", "type", "name", "description", "defaultValue", "public"],
|
||||||
|
secret: process.env.ENC_KEY,
|
||||||
|
saltGenerator: () => process.env.SIG_KEY,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const MetaData = model<IMetaData>("meta", MetaDataSchema);
|
Loading…
x
Reference in New Issue
Block a user