43 lines
No EOL
790 B
TypeScript
43 lines
No EOL
790 B
TypeScript
import { IsArray, IsOptional, IsEnum} from "class-validator";
|
|
import { Schema, model } from "mongoose";
|
|
|
|
export interface ITriggerModel {
|
|
_id?: string;
|
|
type: string;
|
|
value: string[];
|
|
}
|
|
|
|
export const TriggerSchema = new Schema({
|
|
type: {
|
|
type: String,
|
|
require: true,
|
|
},
|
|
value: {
|
|
type: Array,
|
|
require: true,
|
|
},
|
|
});
|
|
|
|
export const triggerSchema = "Trigger";
|
|
|
|
export const TriggerDBModel = model<ITriggerModel>(triggerSchema, TriggerSchema);
|
|
|
|
export enum TriggerType {
|
|
PROCESS = "PROCESS",
|
|
FILE = "FILE",
|
|
}
|
|
|
|
export class TriggerModel implements ITriggerModel {
|
|
@IsOptional()
|
|
public _id: string;
|
|
@IsEnum(TriggerType)
|
|
public type: TriggerType;
|
|
@IsArray()
|
|
public value: string[];
|
|
}
|
|
|
|
export interface Trigger {
|
|
type: TriggerType;
|
|
value: string[];
|
|
}
|
|
|