review app
This commit is contained in:
parent
4a35a3211f
commit
f525a76f6e
38 changed files with 268 additions and 229 deletions
|
@ -0,0 +1,27 @@
|
|||
import { Schema, model } from "mongoose";
|
||||
import { IPipeline } from "../../../core/model/process_model";
|
||||
import { schemaProcess } from "../../process/models/process_database_model";
|
||||
import { triggerSchema } from "../../triggers/models/trigger_database_model";
|
||||
|
||||
export const PipelineSchema = new Schema({
|
||||
process: {
|
||||
type: Schema.Types.ObjectId,
|
||||
ref: schemaProcess,
|
||||
autopopulate: true,
|
||||
default: null,
|
||||
},
|
||||
trigger: {
|
||||
type: Schema.Types.ObjectId,
|
||||
ref: triggerSchema,
|
||||
autopopulate: true,
|
||||
default: null,
|
||||
},
|
||||
stackGenerateType: {
|
||||
type: String,
|
||||
default: null,
|
||||
},
|
||||
}).plugin(require("mongoose-autopopulate"));
|
||||
|
||||
export const schemaPipeline = "Pipeline";
|
||||
|
||||
export const PipelineDBModel = model<IPipeline>(schemaPipeline, PipelineSchema);
|
21
server/src/features/pipelines/models/pipeline_model.ts
Normal file
21
server/src/features/pipelines/models/pipeline_model.ts
Normal file
|
@ -0,0 +1,21 @@
|
|||
import { IsOptional, ValidateNested } from "class-validator";
|
||||
import { IPipeline, IProcess, StackGenerateType } from "../../../core/model/process_model";
|
||||
import { Type } from "class-transformer";
|
||||
import { ProcessModel } from "../../process/models/process_validation_model";
|
||||
import { TriggerModel } from "../../triggers/models/trigger_validation_model";
|
||||
|
||||
export class PipelineModel implements IPipeline {
|
||||
@ValidateNested()
|
||||
@Type(() => ProcessModel)
|
||||
public process: IProcess;
|
||||
|
||||
@ValidateNested()
|
||||
@Type(() => TriggerModel)
|
||||
public trigger: TriggerModel;
|
||||
|
||||
@IsOptional()
|
||||
public env = null;
|
||||
|
||||
@IsOptional()
|
||||
public stackGenerateType: StackGenerateType;
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
import { IsMongoId, IsOptional } from "class-validator";
|
||||
import { IProcess, StackGenerateType } from "../../../core/model/process_model";
|
||||
import { TriggerModel } from "../../triggers/models/trigger_validation_model";
|
||||
|
||||
export class PipelineValidationModel {
|
||||
@IsMongoId()
|
||||
public process: IProcess;
|
||||
|
||||
@IsMongoId()
|
||||
public trigger: TriggerModel;
|
||||
|
||||
@IsOptional()
|
||||
public env = null;
|
||||
|
||||
@IsOptional()
|
||||
public stackGenerateType: StackGenerateType;
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
import { IsMongoId, IsOptional, ValidateNested } from "class-validator";
|
||||
import { Schema, model } from "mongoose";
|
||||
import { IPipeline, IProcess, StackGenerateType } from "../../core/model/process_model";
|
||||
import { TriggerModel, triggerSchema } from "../triggers/trigger_model";
|
||||
import { ProcessModel, schemaProcess } from "../process/process_model";
|
||||
import { Type } from "class-transformer";
|
||||
|
||||
export const PipelineSchema = new Schema({
|
||||
process: {
|
||||
type: Schema.Types.ObjectId,
|
||||
ref: schemaProcess,
|
||||
autopopulate: true,
|
||||
default: null,
|
||||
},
|
||||
trigger: {
|
||||
type: Schema.Types.ObjectId,
|
||||
ref: triggerSchema,
|
||||
autopopulate: true,
|
||||
default: null,
|
||||
},
|
||||
stackGenerateType: {
|
||||
type: String,
|
||||
default: null,
|
||||
},
|
||||
}).plugin(require("mongoose-autopopulate"));
|
||||
|
||||
export const schemaPipeline = "Pipeline";
|
||||
|
||||
export const PipelineDBModel = model<IPipeline>(schemaPipeline, PipelineSchema);
|
||||
|
||||
export class PipelineValidationModel {
|
||||
@IsMongoId()
|
||||
public process: IProcess;
|
||||
|
||||
@IsMongoId()
|
||||
public trigger: TriggerModel;
|
||||
|
||||
@IsOptional()
|
||||
public env = null;
|
||||
|
||||
@IsOptional()
|
||||
public stackGenerateType: StackGenerateType;
|
||||
}
|
||||
|
||||
export class PipelineModel implements IPipeline {
|
||||
@ValidateNested()
|
||||
@Type(() => ProcessModel)
|
||||
public process: IProcess;
|
||||
|
||||
@ValidateNested()
|
||||
@Type(() => TriggerModel)
|
||||
public trigger: TriggerModel;
|
||||
@IsOptional()
|
||||
public env = null;
|
||||
@IsOptional()
|
||||
public stackGenerateType: StackGenerateType;
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
import { CrudController } from "../../core/controllers/crud_controller";
|
||||
import { PipelineDBModel, PipelineValidationModel } from "./pipeline_model";
|
||||
import { PipelineDBModel } from "./models/pipeline_database_model";
|
||||
import { PipelineValidationModel } from "./models/pipeline_validation_model";
|
||||
|
||||
export class PipelinePresentation extends CrudController<PipelineValidationModel, typeof PipelineDBModel> {
|
||||
constructor() {
|
||||
|
|
35
server/src/features/process/models/process_database_model.ts
Normal file
35
server/src/features/process/models/process_database_model.ts
Normal file
|
@ -0,0 +1,35 @@
|
|||
import { Schema, model } from "mongoose";
|
||||
import { IProcess } from "../../../core/model/process_model";
|
||||
|
||||
export const ProcessSchema = new Schema({
|
||||
type: {
|
||||
type: String,
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
},
|
||||
command: {
|
||||
type: String,
|
||||
},
|
||||
isGenerating: {
|
||||
type: String,
|
||||
},
|
||||
isLocaleCode: {
|
||||
type: String,
|
||||
},
|
||||
issueType: {
|
||||
type: String,
|
||||
},
|
||||
timeout: {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
commit: {
|
||||
type: String,
|
||||
default: null,
|
||||
},
|
||||
});
|
||||
|
||||
export const schemaProcess = "Process";
|
||||
|
||||
export const ProcessDBModel = model<IProcess>(schemaProcess, ProcessSchema);
|
|
@ -0,0 +1,31 @@
|
|||
import { IsBoolean, IsEnum, IsNumber, IsOptional, IsString } from "class-validator";
|
||||
import { EXEC_TYPE } from "../../../core/model/exec_error_model";
|
||||
import { IProcess, IssueType } from "../../../core/model/process_model";
|
||||
|
||||
export class ProcessModel implements IProcess {
|
||||
@IsEnum(EXEC_TYPE)
|
||||
public type: EXEC_TYPE;
|
||||
|
||||
@IsString()
|
||||
public description: string;
|
||||
|
||||
@IsString()
|
||||
public command: string;
|
||||
|
||||
@IsBoolean()
|
||||
public isGenerating: boolean;
|
||||
|
||||
@IsBoolean()
|
||||
public isLocaleCode: boolean;
|
||||
|
||||
@IsEnum(IssueType)
|
||||
public issueType: IssueType;
|
||||
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
public timeout?: number;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
public commit?: string;
|
||||
}
|
|
@ -1,65 +0,0 @@
|
|||
import { IsString, IsOptional, IsEnum, IsNumber, IsBoolean } from "class-validator";
|
||||
import { Schema, model } from "mongoose";
|
||||
import { IProcess, IssueType } from "../../core/model/process_model";
|
||||
import { EXEC_TYPE } from "../../core/model/exec_error_model";
|
||||
|
||||
export const ProcessSchema = new Schema({
|
||||
type: {
|
||||
type: String,
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
},
|
||||
command: {
|
||||
type: String,
|
||||
},
|
||||
isGenerating: {
|
||||
type: String,
|
||||
},
|
||||
isLocaleCode: {
|
||||
type: String,
|
||||
},
|
||||
issueType: {
|
||||
type: String,
|
||||
},
|
||||
timeout: {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
commit: {
|
||||
type: String,
|
||||
default: null,
|
||||
},
|
||||
});
|
||||
|
||||
export const schemaProcess = "Process";
|
||||
|
||||
export const ProcessDBModel = model<IProcess>(schemaProcess, ProcessSchema);
|
||||
|
||||
export class ProcessModel implements IProcess {
|
||||
@IsEnum(EXEC_TYPE)
|
||||
public type: EXEC_TYPE;
|
||||
|
||||
@IsString()
|
||||
public description: string;
|
||||
|
||||
@IsString()
|
||||
public command: string;
|
||||
|
||||
@IsBoolean()
|
||||
public isGenerating: boolean;
|
||||
|
||||
@IsBoolean()
|
||||
public isLocaleCode: boolean;
|
||||
|
||||
@IsEnum(IssueType)
|
||||
public issueType: IssueType;
|
||||
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
public timeout?: number;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
public commit?: string;
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
import { CrudController } from "../../core/controllers/crud_controller";
|
||||
import { ProcessDBModel, ProcessModel } from "./process_model";
|
||||
import { ProcessDBModel } from "./models/process_database_model";
|
||||
import { ProcessModel } from "./models/process_validation_model";
|
||||
|
||||
export class ProcessPresentation extends CrudController<ProcessModel, typeof ProcessDBModel> {
|
||||
constructor() {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import { App } from "../../core/controllers/app";
|
||||
import { Result } from "../../core/helper/result";
|
||||
import { CreateDataBaseModelUseCase } from "../../core/usecases/create_database_model_usecase";
|
||||
import { CreateFolderUseCase } from "../../core/usecases/crete_folder_usecase";
|
||||
import { ProjectInstanceDbModel, ProjectInstanceValidationModel } from "./project_instance_model";
|
||||
import { App } from "../../../core/controllers/app";
|
||||
import { Result } from "../../../core/helper/result";
|
||||
import { CreateDataBaseModelUseCase } from "../../../core/usecases/create_database_model_usecase";
|
||||
import { CreateFolderUseCase } from "../../../core/usecases/crete_folder_usecase";
|
||||
import { ProjectInstanceDbModel } from "../models/project_instance_database_model";
|
||||
import { ProjectInstanceValidationModel } from "../models/project_instance_validation_model";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
|
||||
export class CreateNewProjectInstanceScenario {
|
|
@ -1,15 +1,11 @@
|
|||
import { App } from "../../core/controllers/app";
|
||||
import { CallbackStrategyWithFileUpload, ResponseBase } from "../../core/controllers/http_controller";
|
||||
import { Result } from "../../core/helper/result";
|
||||
import { CreateFileUseCase } from "../../core/usecases/create_file_usecase";
|
||||
import { PipelineStatusUseCase } from "../realtime/usecases/pipeline_status_usecase";
|
||||
|
||||
export interface IFile extends File {
|
||||
data: Buffer;
|
||||
}
|
||||
import { CallbackStrategyWithFileUpload, ResponseBase } from "../../../core/controllers/http_controller";
|
||||
import { Result } from "../../../core/helper/result";
|
||||
import { IFile } from "../../../core/interfaces/file";
|
||||
import { CreateFileUseCase } from "../../../core/usecases/create_file_usecase";
|
||||
import { PipelineStatusUseCase } from "../../realtime/domain/pipeline_status_usecase";
|
||||
|
||||
export class UploadCadFileToProjectScenario extends CallbackStrategyWithFileUpload {
|
||||
checkingFileExpression: RegExp = RegExp(".pages");
|
||||
checkingFileExpression: RegExp = RegExp(".FCStd");
|
||||
|
||||
async call(file: IFile): ResponseBase {
|
||||
const pipelineStatusUseCase = await new PipelineStatusUseCase().call();
|
||||
|
@ -17,7 +13,6 @@ export class UploadCadFileToProjectScenario extends CallbackStrategyWithFileUplo
|
|||
return pipelineStatusUseCase.forward();
|
||||
}
|
||||
const projectFolder = pipelineStatusUseCase.value.path;
|
||||
// TODO:
|
||||
const createFileUseCase = await new CreateFileUseCase().call(projectFolder + file.name, file.data);
|
||||
if (createFileUseCase.isFailure()) {
|
||||
return createFileUseCase.forward();
|
|
@ -1,6 +1,5 @@
|
|||
import { Schema, model } from "mongoose";
|
||||
import { IProjectModel, projectSchema } from "../projects/projects_model";
|
||||
import { IsMongoId, IsOptional, IsString } from "class-validator";
|
||||
import { IProjectModel, projectSchema } from "../../projects/models/project_database_model";
|
||||
|
||||
export interface IProjectInstanceModel {
|
||||
_id: string;
|
||||
|
@ -32,12 +31,3 @@ export const ProjectInstanceSchema = new Schema({
|
|||
export const schemaProjectInstance = "instance_project";
|
||||
|
||||
export const ProjectInstanceDbModel = model<IProjectInstanceModel>(schemaProjectInstance, ProjectInstanceSchema);
|
||||
|
||||
export class ProjectInstanceValidationModel {
|
||||
@IsMongoId()
|
||||
public project: string;
|
||||
@IsString()
|
||||
public description: string;
|
||||
@IsOptional()
|
||||
public rootDir: string;
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
import { IsMongoId, IsOptional, IsString } from "class-validator";
|
||||
|
||||
export class ProjectInstanceValidationModel {
|
||||
@IsMongoId()
|
||||
public project: string;
|
||||
|
||||
@IsString()
|
||||
public description: string;
|
||||
|
||||
@IsOptional()
|
||||
public rootDir: string;
|
||||
}
|
|
@ -1,7 +1,8 @@
|
|||
import { CrudController } from "../../core/controllers/crud_controller";
|
||||
import { CreateNewProjectInstanceScenario } from "./create_new_project_scenario";
|
||||
import { ProjectInstanceDbModel, ProjectInstanceValidationModel } from "./project_instance_model";
|
||||
import { UploadCadFileToProjectScenario } from "./upload_file_to_to_project_scenario";
|
||||
import { CreateNewProjectInstanceScenario } from "./domain/create_new_project_scenario";
|
||||
import { UploadCadFileToProjectScenario } from "./domain/upload_file_to_to_project_scenario";
|
||||
import { ProjectInstanceDbModel } from "./models/project_instance_database_model";
|
||||
import { ProjectInstanceValidationModel } from "./models/project_instance_validation_model";
|
||||
|
||||
export class ProjectInstancePresentation extends CrudController<
|
||||
ProjectInstanceValidationModel,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { Schema, model } from "mongoose";
|
||||
import { PipelineValidationModel, schemaPipeline } from "../pipelines/pipeline_model";
|
||||
import { IsArray, IsString } from "class-validator";
|
||||
import { schemaPipeline } from "../../pipelines/models/pipeline_database_model";
|
||||
import { PipelineValidationModel } from "../../pipelines/models/pipeline_validation_model";
|
||||
|
||||
export interface IProjectModel {
|
||||
_id?: string;
|
||||
|
@ -29,10 +29,3 @@ export const ProjectSchema = new Schema({
|
|||
export const projectSchema = "Projects";
|
||||
|
||||
export const ProjectDBModel = model<IProjectModel>(projectSchema, ProjectSchema);
|
||||
|
||||
export class ProjectValidationModel {
|
||||
@IsArray()
|
||||
public pipelines: [string];
|
||||
@IsString()
|
||||
public description: string;
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
import { IsArray, IsString } from "class-validator";
|
||||
|
||||
export class ProjectValidationModel {
|
||||
@IsArray()
|
||||
public pipelines: [string];
|
||||
|
||||
@IsString()
|
||||
public description: string;
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
import { CrudController } from "../../core/controllers/crud_controller";
|
||||
import { ProjectDBModel, ProjectValidationModel } from "./projects_model";
|
||||
import { ProjectDBModel } from "./models/project_database_model";
|
||||
import { ProjectValidationModel } from "./models/project_validation_model";
|
||||
|
||||
export class ProjectsPresentation extends CrudController<ProjectValidationModel, typeof ProjectDBModel> {
|
||||
constructor() {
|
||||
|
|
|
@ -2,7 +2,10 @@ import { App } from "../../../core/controllers/app";
|
|||
import { Result } from "../../../core/helper/result";
|
||||
import { ReadByIdDataBaseModelUseCase } from "../../../core/usecases/read_by_id_database_model_usecase";
|
||||
import { UpdateDataBaseModelUseCase } from "../../../core/usecases/update_database_model_usecase";
|
||||
import { IProjectInstanceModel, ProjectInstanceDbModel } from "../../project_instance/project_instance_model";
|
||||
import {
|
||||
IProjectInstanceModel,
|
||||
ProjectInstanceDbModel,
|
||||
} from "../../project_instance/models/project_instance_database_model";
|
||||
import { RealTimeValidationModel, pipelineRealTimeService } from "../realtime_presentation";
|
||||
|
||||
export class RunInstancePipelineUseCase {
|
|
@ -1,8 +1,8 @@
|
|||
import { IsString } from "class-validator";
|
||||
import { CoreHttpController } from "../../core/controllers/http_controller";
|
||||
import { PipelineRealTimeService } from "../../core/services/pipeline_real_time_service";
|
||||
import { RunInstancePipelineUseCase } from "./usecases/run_instance_pipeline_usecase";
|
||||
import { PipelineStatusUseCase } from "./usecases/pipeline_status_usecase";
|
||||
import { RunInstancePipelineUseCase } from "./domain/run_instance_pipeline_usecase";
|
||||
import { PipelineStatusUseCase } from "./domain/pipeline_status_usecase";
|
||||
|
||||
export const pipelineRealTimeService = new PipelineRealTimeService();
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import { IsArray, IsOptional, IsEnum, IsString } from "class-validator";
|
||||
import { Schema, model } from "mongoose";
|
||||
|
||||
export interface ITriggerModel {
|
||||
|
@ -31,17 +30,6 @@ export enum TriggerType {
|
|||
FILE = "FILE",
|
||||
}
|
||||
|
||||
export class TriggerModel implements ITriggerModel {
|
||||
@IsOptional()
|
||||
public _id: string;
|
||||
@IsString()
|
||||
public description;
|
||||
@IsEnum(TriggerType)
|
||||
public type: TriggerType;
|
||||
@IsArray()
|
||||
public value: string[];
|
||||
}
|
||||
|
||||
export interface Trigger {
|
||||
type: TriggerType;
|
||||
value: string[];
|
|
@ -0,0 +1,16 @@
|
|||
import { IsArray, IsOptional, IsEnum, IsString } from "class-validator";
|
||||
import { ITriggerModel, TriggerType } from "./trigger_database_model";
|
||||
|
||||
export class TriggerModel implements ITriggerModel {
|
||||
@IsOptional()
|
||||
public _id: string;
|
||||
|
||||
@IsString()
|
||||
public description;
|
||||
|
||||
@IsEnum(TriggerType)
|
||||
public type: TriggerType;
|
||||
|
||||
@IsArray()
|
||||
public value: string[];
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
import { TriggerDBModel, TriggerModel } from "./trigger_model";
|
||||
import { CrudController } from "../../core/controllers/crud_controller";
|
||||
import { TriggerDBModel } from "./models/trigger_database_model";
|
||||
import { TriggerModel } from "./models/trigger_validation_model";
|
||||
|
||||
export class TriggerPresentation extends CrudController<TriggerModel, typeof TriggerDBModel> {
|
||||
constructor() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue