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