import { Schema, model } from "mongoose"; import { PipelineModel, schemaPipeline } from "../pipelines/pipeline_model"; import { IsArray, IsOptional, IsString } from "class-validator"; export interface IProjectModel { _id?:string; pipelines: [PipelineModel]; rootDir: string; description: string; } export const ProjectSchema = new Schema({ pipelines: { type: Array, ref: schemaPipeline, autopopulate: true, default: null, }, rootDir: { type: String, }, description: { type: String, }, }).plugin(require("mongoose-autopopulate")); const schema = "Projects"; export const ProjectDBModel = model(schema, ProjectSchema); export class ProjectValidationModel { @IsArray() public pipelines: [string]; @IsString() public description: string; @IsOptional() public rootDir: string; }