2023-10-27 21:22:48 +03:00
|
|
|
import mongoose, { Schema, model } from "mongoose";
|
|
|
|
import { PipelineModel, schemaPipeline } from "../pipelines/pipeline_model";
|
|
|
|
|
|
|
|
export interface IProjectModel {
|
|
|
|
pipelines: [PipelineModel];
|
|
|
|
rootDir: string;
|
|
|
|
}
|
2023-10-26 17:44:54 +03:00
|
|
|
|
|
|
|
|
|
|
|
export const ProjectSchema = new Schema({
|
2023-10-27 21:22:48 +03:00
|
|
|
pipelines: {
|
|
|
|
type: Array<Schema.Types.ObjectId>,
|
|
|
|
ref: schemaPipeline,
|
|
|
|
autopopulate: true,
|
|
|
|
default: null,
|
|
|
|
},
|
|
|
|
rootDir: {
|
|
|
|
type: String,
|
|
|
|
},
|
|
|
|
}).plugin(require("mongoose-autopopulate"));
|
2023-10-26 17:44:54 +03:00
|
|
|
|
|
|
|
const schema = "Projects";
|
|
|
|
|
|
|
|
export const ProjectDBModel = model<IProjectModel>(schema, ProjectSchema);
|
|
|
|
|
2023-10-27 21:22:48 +03:00
|
|
|
export class ProjectModel implements IProjectModel {
|
|
|
|
pipelines: [PipelineModel];
|
|
|
|
rootDir: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
// export class ProcessModel implements IProcessMetaData {
|
|
|
|
|
|
|
|
// public process: IProcess;
|
|
|
|
|
|
|
|
// public trigger: ObjectId;
|
|
|
|
|
|
|
|
// // TODO(IDONTSUDO): later, when maintaining many environments, you will need to make a table
|
|
|
|
// public env = null;
|
|
|
|
|
|
|
|
// @IsEnum(StackGenerateType)
|
|
|
|
// public stackGenerateType: StackGenerateType;
|
|
|
|
// }
|