MVP back end

This commit is contained in:
IDONTSUDO 2023-10-31 09:03:39 +00:00 committed by Igor Brylyov
parent 528b9f67d4
commit 889fc95c3d
51 changed files with 1048 additions and 426 deletions

View file

@ -0,0 +1,43 @@
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[];
}