webstudio/server/src/features/_projects/models/project_database_model.ts

28 lines
637 B
TypeScript
Raw Normal View History

2023-10-31 09:03:41 +03:00
import { Schema, model } from "mongoose";
import { PipelineValidationModel } from "../../_pipelines/models/pipeline_validation_model";
2023-10-27 21:22:48 +03:00
export interface IProjectModel {
2023-11-20 00:48:40 +03:00
_id?: string;
pipelines: [PipelineValidationModel];
2023-10-27 21:22:48 +03:00
rootDir: string;
2023-11-10 12:06:40 +03:00
description: string;
isActive: boolean;
2023-10-27 21:22:48 +03:00
}
2023-10-26 17:44:54 +03:00
export const ProjectSchema = new Schema({
2023-11-10 12:06:40 +03:00
description: {
type: String,
},
rootDir: {
type: String,
},
2023-11-20 00:48:40 +03:00
isActive: {
type: Boolean,
default: false,
},
2023-10-27 21:22:48 +03:00
}).plugin(require("mongoose-autopopulate"));
2023-10-26 17:44:54 +03:00
2023-11-20 00:48:40 +03:00
export const projectSchema = "Projects";
2023-10-26 17:44:54 +03:00
2023-11-20 00:48:40 +03:00
export const ProjectDBModel = model<IProjectModel>(projectSchema, ProjectSchema);