progress
This commit is contained in:
parent
d41310196f
commit
48be3e6d33
110 changed files with 1722 additions and 1145 deletions
|
@ -199,7 +199,6 @@ export class CoreHttpController<V> implements ICoreHttpController {
|
|||
if (req.query.page !== undefined) {
|
||||
payload = String(req.query.page);
|
||||
}
|
||||
|
||||
if (req.query.id !== undefined) {
|
||||
payload = String(req.query.id);
|
||||
}
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
import { BehaviorTreesPresentation } from "../../features/behavior_trees/behavior_trees_presentation";
|
||||
import { DatasetsPresentation } from "../../features/datasets/datasets_presentation";
|
||||
import { WeightsPresentation } from "../../features/weights/weights_presentation";
|
||||
import { CalculationsTemplatePresentation } from "../../features/calculations_templates/calculations_template_presentation";
|
||||
import { ProjectsPresentation } from "../../features/projects/projects_presentation";
|
||||
import { extensions } from "../extensions/extensions";
|
||||
import { Routes } from "../interfaces/router";
|
||||
import { ScenePresentation } from "../../features/scene/scene_presentation";
|
||||
import { ScenesPresentation } from "../../features/scenes/scenes_presentation";
|
||||
import { CalculationsInstancesPresentation } from "../../features/calculations_instance/calculations_instance_presentation";
|
||||
|
||||
extensions();
|
||||
|
||||
|
@ -12,6 +13,7 @@ export const httpRoutes: Routes[] = [
|
|||
new ProjectsPresentation(),
|
||||
new DatasetsPresentation(),
|
||||
new BehaviorTreesPresentation(),
|
||||
new WeightsPresentation(),
|
||||
new ScenePresentation()
|
||||
new CalculationsTemplatePresentation(),
|
||||
new ScenesPresentation(),
|
||||
new CalculationsInstancesPresentation(),
|
||||
].map((el) => el.call());
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
// import { Service } from "typedi";
|
||||
|
||||
// @Service()
|
||||
// export class IEnv{
|
||||
// rootFolder!: string;
|
||||
// constructor(){
|
||||
|
||||
// }
|
||||
// toStringEnv(){
|
||||
// return ''
|
||||
// }
|
||||
// static env(){
|
||||
// return ''
|
||||
// }
|
||||
// }
|
||||
|
||||
// @Service()
|
||||
// export class DevEnv implements IEnv {
|
||||
// rootFolder:string;
|
||||
// constructor(rootFolder:string){
|
||||
// this.rootFolder = rootFolder
|
||||
// }
|
||||
// toStringEnv(): string {
|
||||
// return DevEnv.env()
|
||||
// }
|
||||
// static env(){
|
||||
// return 'DevEnv'
|
||||
|
||||
// }
|
||||
// }
|
||||
// @Service()
|
||||
// export class UnitTestEnv implements IEnv{
|
||||
// rootFolder:string;
|
||||
// constructor(rootFolder:string){
|
||||
// this.rootFolder = rootFolder
|
||||
// }
|
||||
// toStringEnv(): string {
|
||||
// return UnitTestEnv.env()
|
||||
// }
|
||||
// static env(){
|
||||
// return 'UnitTestEnv'
|
||||
|
||||
// }
|
||||
// }
|
|
@ -1,53 +0,0 @@
|
|||
// import { DevEnv, IEnv, UnitTestEnv } from "./env";
|
||||
// import { extensions } from "../extensions/extensions";
|
||||
// // import { Container, Service } from 'typedi';
|
||||
|
||||
// export default function locator(env: IEnv) {
|
||||
// extensions();
|
||||
// envRegister(env);
|
||||
// registerRepository(env);
|
||||
// registerController(env);
|
||||
// registerService(env);
|
||||
// // override(MetaDataFileManagerModel, MetaDataFileManagerModel);
|
||||
// }
|
||||
|
||||
// const envRegister = (env: IEnv) => {
|
||||
// switch (env.toStringEnv()) {
|
||||
// case UnitTestEnv.env():
|
||||
// // override(IEnv, UnitTestEnv);
|
||||
// return;
|
||||
// case "DevEnv":
|
||||
// // override(IEnv, DevEnv);
|
||||
// return;
|
||||
// }
|
||||
// };
|
||||
|
||||
// const registerRepository = (env: IEnv) => {
|
||||
// switch (env.toStringEnv()) {
|
||||
// case UnitTestEnv.env():
|
||||
// // override(IEnv, UnitTestEnv);
|
||||
|
||||
// return;
|
||||
// case DevEnv.env():
|
||||
// // override(IEnv, DevEnv);
|
||||
// return;
|
||||
// }
|
||||
// };
|
||||
|
||||
// const registerController = (env: IEnv) => {
|
||||
// switch (env.toStringEnv()) {
|
||||
// case UnitTestEnv.env():
|
||||
// return;
|
||||
// case DevEnv.env():
|
||||
// return;
|
||||
// }
|
||||
// };
|
||||
|
||||
// const registerService = (env: IEnv) => {
|
||||
// switch (env.toStringEnv()) {
|
||||
// case UnitTestEnv.env():
|
||||
// return;
|
||||
// case DevEnv.env():
|
||||
// return;
|
||||
// }
|
||||
// };
|
|
@ -1,8 +1,9 @@
|
|||
export enum StaticFiles {
|
||||
robossembler_assets = "robossembler_assets.json",
|
||||
assets = "/assets/assets.json",
|
||||
parts = '/assets/parts.json',
|
||||
robots = '/robots/',
|
||||
scenes = '/scenes/',
|
||||
behaviorTrees = 'behavior_trees'
|
||||
parts = "/assets/parts.json",
|
||||
robots = "/robots/",
|
||||
scenes = "/scenes/",
|
||||
behaviorTrees = "behavior_trees",
|
||||
process = "/process/",
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ export class FileSystemRepository {
|
|||
}
|
||||
return await this.readFileAsync(path);
|
||||
}
|
||||
deleteFile = async (path: string) => {
|
||||
delete = async (path: string) => {
|
||||
return await this.deleteDir(path);
|
||||
};
|
||||
readDirRecursive(path: string, filesToDir: string[] = []): string[] {
|
||||
|
|
|
@ -5,7 +5,7 @@ export class DeleteFileUseCase {
|
|||
fileSystemRepository = new FileSystemRepository();
|
||||
call = (path: string) => {
|
||||
try {
|
||||
this.fileSystemRepository.deleteFile(path);
|
||||
this.fileSystemRepository.delete(path);
|
||||
return Result.ok("file delete");
|
||||
} catch {
|
||||
return Result.error("Unknown error");
|
||||
|
|
|
@ -4,7 +4,6 @@ import { FileSystemRepository } from "../repository/file_system_repository";
|
|||
export class DeleteRecursiveFolderUseCase{
|
||||
repository:FileSystemRepository = new FileSystemRepository()
|
||||
call = async (path:string):Promise<Result<void,void>> =>{
|
||||
console.log(path)
|
||||
await this.repository.deleteDirRecursive(path)
|
||||
return Result.ok()
|
||||
}
|
||||
|
|
|
@ -2,12 +2,12 @@ import { CrudController } from "../../core/controllers/crud_controller";
|
|||
import { TriggerDBModel } from "./models/trigger_database_model";
|
||||
import { TriggerModelValidationModel } from "./models/trigger_validation_model";
|
||||
|
||||
export class TriggerPresentation extends CrudController<TriggerModelValidationModel, typeof TriggerDBModel> {
|
||||
constructor() {
|
||||
super({
|
||||
url: "trigger",
|
||||
validationModel: TriggerModelValidationModel,
|
||||
databaseModel: TriggerDBModel,
|
||||
});
|
||||
}
|
||||
}
|
||||
// export class TriggerPresentation extends CrudController<TriggerModelValidationModel, typeof TriggerDBModel> {
|
||||
// constructor() {
|
||||
// super({
|
||||
// url: "trigger",
|
||||
// validationModel: TriggerModelValidationModel,
|
||||
// databaseModel: TriggerDBModel,
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
import { CrudController } from "../../core/controllers/crud_controller";
|
||||
import { ExecCalculationInstanceProcessScenario } from "./domain/exec_calculations_instance_process_scenario";
|
||||
import { CalculationInstanceValidationModel } from "./models/calculations_instance_validation_model";
|
||||
import { CalculationInstanceDBModel } from "./models/calculations_instance_database_model";
|
||||
import { CreateCalculationInstanceScenario } from "./domain/create_calculation_instance_scenario";
|
||||
import { DeleteCalculationsInstanceScenario } from "./domain/delete_calculations_instance_scenario";
|
||||
|
||||
export class CalculationsInstancesPresentation extends CrudController<
|
||||
CalculationInstanceValidationModel,
|
||||
typeof CalculationInstanceDBModel
|
||||
> {
|
||||
constructor() {
|
||||
super({
|
||||
url: "calculations/instances",
|
||||
validationModel: CalculationInstanceValidationModel,
|
||||
databaseModel: CalculationInstanceDBModel,
|
||||
});
|
||||
|
||||
super.delete(new DeleteCalculationsInstanceScenario().call);
|
||||
super.post(new CreateCalculationInstanceScenario().call);
|
||||
|
||||
this.subRoutes.push({
|
||||
method: "GET",
|
||||
subUrl: "exec",
|
||||
fn: new ExecCalculationInstanceProcessScenario(),
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
import { CallbackStrategyWithValidationModel, ResponseBase } from "../../../core/controllers/http_controller";
|
||||
import { CreateDataBaseModelUseCase } from "../../../core/usecases/create_database_model_usecase";
|
||||
import { CreateFolderUseCase } from "../../../core/usecases/create_folder_usecase";
|
||||
import { CalculationInstanceDBModel } from "../models/calculations_instance_database_model";
|
||||
import { CalculationInstanceValidationModel } from "../models/calculations_instance_validation_model";
|
||||
|
||||
export class CreateCalculationInstanceScenario extends CallbackStrategyWithValidationModel<CalculationInstanceValidationModel> {
|
||||
validationModel: CalculationInstanceValidationModel = new CalculationInstanceValidationModel();
|
||||
call = async (model: CalculationInstanceValidationModel): ResponseBase => {
|
||||
model.instancePath = `${model.path}/${model.instanceName}`;
|
||||
return (await new CreateFolderUseCase().call(model.instancePath)).map(
|
||||
async () => await new CreateDataBaseModelUseCase(CalculationInstanceDBModel).call(model)
|
||||
);
|
||||
};
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
import { CallbackStrategyWithIdQuery, ResponseBase } from "../../../core/controllers/http_controller";
|
||||
import { DeleteDataBaseModelUseCase } from "../../../core/usecases/delete_database_model_usecase";
|
||||
import { DeleteRecursiveFolderUseCase } from "../../../core/usecases/delete_recursive_folder_usecase";
|
||||
import { ReadByIdDataBaseModelUseCase } from "../../../core/usecases/read_by_id_database_model_usecase";
|
||||
import { CoreValidation } from "../../../core/validations/core_validation";
|
||||
import { MongoIdValidation } from "../../../core/validations/mongo_id_validation";
|
||||
import { CalculationsTemplateDBModel } from "../../calculations_templates/models/calculations_template_database_model";
|
||||
import { CalculationInstanceDBModel } from "../models/calculations_instance_database_model";
|
||||
import { CalculationInstanceValidationModel } from "../models/calculations_instance_validation_model";
|
||||
|
||||
export class DeleteCalculationsInstanceScenario extends CallbackStrategyWithIdQuery {
|
||||
idValidationExpression: CoreValidation = new MongoIdValidation();
|
||||
call = async (id: string): ResponseBase =>
|
||||
(
|
||||
await new ReadByIdDataBaseModelUseCase<CalculationInstanceValidationModel>(CalculationInstanceDBModel).call(id)
|
||||
).map(async (model) => {
|
||||
return (await new DeleteRecursiveFolderUseCase().call(model.instancePath)).map(
|
||||
async () => await new DeleteDataBaseModelUseCase(CalculationInstanceDBModel).call(id)
|
||||
);
|
||||
});
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
import { ObjectId } from "mongoose";
|
||||
import { CallbackStrategyWithIdQuery, ResponseBase } from "../../../core/controllers/http_controller";
|
||||
import { ExecProcessUseCase, IsHaveActiveProcessUseCase } from "../../../core/usecases/exec_process_usecase";
|
||||
import { ReadByIdDataBaseModelUseCase } from "../../../core/usecases/read_by_id_database_model_usecase";
|
||||
import { MongoIdValidation } from "../../../core/validations/mongo_id_validation";
|
||||
import { ProcessWatcherAndDatabaseUpdateService } from "../../datasets/domain/create_dataset_scenario";
|
||||
import { CalculationInstanceDBModel, ICalculationInstance } from "../models/calculations_instance_database_model";
|
||||
import { Result } from "../../../core/helpers/result";
|
||||
|
||||
export class ExecCalculationInstanceProcessScenario extends CallbackStrategyWithIdQuery {
|
||||
idValidationExpression = new MongoIdValidation();
|
||||
call = async (id: string): ResponseBase =>
|
||||
(await new ReadByIdDataBaseModelUseCase<ICalculationInstance>(CalculationInstanceDBModel).call(id)).map(
|
||||
async (model) => {
|
||||
return (await new IsHaveActiveProcessUseCase().call()).map(async () => {
|
||||
const execCommand = `${model.script} --form ${JSON.stringify(model.formBuilder)} --path ${
|
||||
model.instancePath
|
||||
}`;
|
||||
await CalculationInstanceDBModel.findById(id).updateOne({
|
||||
processStatus: "RUN",
|
||||
lastProcessExecCommand: execCommand,
|
||||
});
|
||||
new ExecProcessUseCase().call(
|
||||
// @ts-expect-error
|
||||
|
||||
`${model.project.rootDir}/`,
|
||||
execCommand,
|
||||
id,
|
||||
new ProcessWatcherAndDatabaseUpdateService(id as unknown as ObjectId, CalculationInstanceDBModel)
|
||||
);
|
||||
return Result.ok("OK");
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
|
@ -1,11 +1,11 @@
|
|||
import { ResponseBase } from "../../../core/controllers/http_controller";
|
||||
import { SearchManyDataBaseModelUseCase } from "../../../core/usecases/search_many_database_model_usecase";
|
||||
import { GetActiveProjectIdScenario } from "../../projects/domain/get_active_project_id_scenario";
|
||||
import { IWeightModel, WeightDBModel } from "../models/weights_validation_model";
|
||||
import { ICalculationInstance, CalculationInstanceDBModel } from "../models/calculations_instance_database_model";
|
||||
|
||||
export class GetAllWeightsActiveProjectScenarios {
|
||||
call = async (): ResponseBase =>
|
||||
(await new GetActiveProjectIdScenario().call()).map(
|
||||
async (model) => await new SearchManyDataBaseModelUseCase<IWeightModel>(WeightDBModel).call({ project: model.id })
|
||||
async (model) => await new SearchManyDataBaseModelUseCase<ICalculationInstance>(CalculationInstanceDBModel).call({ project: model.id })
|
||||
);
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
import { Schema, model } from "mongoose";
|
||||
import { FormBuilderValidationModel } from "../../datasets/models/dataset_validation_model";
|
||||
import { IProjectModel, projectSchema } from "../../projects/models/project_model_database_model";
|
||||
|
||||
export interface ICalculationInstance {
|
||||
script: string;
|
||||
instancePath: string;
|
||||
formBuilder: FormBuilderValidationModel;
|
||||
type: string;
|
||||
name: string;
|
||||
isEnd: boolean;
|
||||
createDate: Date;
|
||||
card?: string;
|
||||
lastProcessLogs?: string;
|
||||
lastProcessExecCommand?: string;
|
||||
lastExecDate?: Date;
|
||||
processStatus: string;
|
||||
project?: IProjectModel | string;
|
||||
}
|
||||
|
||||
export const CalculationInstanceSchema = new Schema({
|
||||
script: {
|
||||
type: String,
|
||||
},
|
||||
formBuilder: {
|
||||
type: Schema.Types.Mixed,
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
},
|
||||
instanceName: {
|
||||
type: String,
|
||||
},
|
||||
name: {
|
||||
type: String,
|
||||
},
|
||||
isEnd: {
|
||||
type: Boolean,
|
||||
},
|
||||
createDate: {
|
||||
type: String,
|
||||
},
|
||||
card: {
|
||||
type: String,
|
||||
},
|
||||
lastProcessLogs: {
|
||||
type: String,
|
||||
},
|
||||
lastProcessExecCommand: {
|
||||
type: String,
|
||||
},
|
||||
lastExecDate: {
|
||||
type: String,
|
||||
},
|
||||
processStatus: {
|
||||
type: String,
|
||||
},
|
||||
path: {
|
||||
type: String,
|
||||
},
|
||||
instancePath: {
|
||||
type: String,
|
||||
},
|
||||
project: {
|
||||
type: Schema.Types.ObjectId,
|
||||
ref: projectSchema,
|
||||
autopopulate: true,
|
||||
require: true,
|
||||
},
|
||||
}).plugin(require("mongoose-autopopulate"));
|
||||
|
||||
export const calculationInstanceSchema = "calculations_instances";
|
||||
|
||||
export const CalculationInstanceDBModel = model<ICalculationInstance>(
|
||||
calculationInstanceSchema,
|
||||
CalculationInstanceSchema
|
||||
);
|
|
@ -0,0 +1,31 @@
|
|||
import { IsNotEmpty, IsString, IsMongoId } from "class-validator";
|
||||
import { ICalculationInstance } from "./calculations_instance_database_model";
|
||||
import { FormBuilderValidationModel } from "../../datasets/models/dataset_validation_model";
|
||||
import { IProjectModel } from "../../projects/models/project_model_database_model";
|
||||
|
||||
export class CalculationInstanceValidationModel implements ICalculationInstance {
|
||||
@IsNotEmpty()
|
||||
@IsString()
|
||||
instanceName: string;
|
||||
instancePath: string;
|
||||
processStatus: string;
|
||||
@IsString()
|
||||
path: string;
|
||||
project?: string | IProjectModel;
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
script: string;
|
||||
formBuilder: FormBuilderValidationModel;
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
type: string;
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
name: string;
|
||||
isEnd: boolean = false;
|
||||
createDate: Date = new Date();
|
||||
card?: string;
|
||||
lastProcessLogs?: string;
|
||||
lastProcessExecCommand?: string;
|
||||
lastExecDate?: Date;
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
import { CrudController } from "../../core/controllers/crud_controller";
|
||||
import { CreateCalculationsTemplateScenario } from "./domain/create_calculations_template_scenario";
|
||||
import { DeleteCalculationsTemplateScenario } from "./domain/delete_calculations_template_scenario";
|
||||
import { CalculationsTemplateValidationModel as CalculationsTemplateValidationModel } from "./models/calculations_template_validation_model";
|
||||
import { CalculationsTemplateDBModel } from "./models/calculations_template_database_model";
|
||||
|
||||
export class CalculationsTemplatePresentation extends CrudController<
|
||||
CalculationsTemplateValidationModel,
|
||||
typeof CalculationsTemplateDBModel
|
||||
> {
|
||||
constructor() {
|
||||
super({
|
||||
url: "calculations/template",
|
||||
validationModel: CalculationsTemplateValidationModel,
|
||||
databaseModel: CalculationsTemplateDBModel,
|
||||
});
|
||||
super.post(new CreateCalculationsTemplateScenario().call);
|
||||
super.delete(new DeleteCalculationsTemplateScenario().call);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
import { CallbackStrategyWithValidationModel, ResponseBase } from "../../../core/controllers/http_controller";
|
||||
import { Result } from "../../../core/helpers/result";
|
||||
import { StaticFiles } from "../../../core/models/static_files";
|
||||
import { CreateDataBaseModelUseCase } from "../../../core/usecases/create_database_model_usecase";
|
||||
import { CreateFolderUseCase } from "../../../core/usecases/create_folder_usecase";
|
||||
import { SearchOneDataBaseModelUseCase } from "../../../core/usecases/search_database_model_usecase";
|
||||
import { IProjectModel, ProjectDBModel } from "../../projects/models/project_model_database_model";
|
||||
import { CalculationsTemplateValidationModel } from "../models/calculations_template_validation_model";
|
||||
import { CalculationsTemplateDBModel } from "../models/calculations_template_database_model";
|
||||
|
||||
export class CreateCalculationsTemplateScenario extends CallbackStrategyWithValidationModel<CalculationsTemplateValidationModel> {
|
||||
validationModel: CalculationsTemplateValidationModel = new CalculationsTemplateValidationModel();
|
||||
call = async (model: CalculationsTemplateValidationModel): ResponseBase => {
|
||||
return (
|
||||
await new SearchOneDataBaseModelUseCase<IProjectModel>(ProjectDBModel).call(
|
||||
{ isActive: true },
|
||||
"no active projects"
|
||||
)
|
||||
).map(async (project) => {
|
||||
model.path = project.rootDir + StaticFiles.process + model.name;
|
||||
return (await new CreateFolderUseCase().call(model.path)).map(() => {
|
||||
return new CreateDataBaseModelUseCase(CalculationsTemplateDBModel).call(model);
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
import { CallbackStrategyWithIdQuery, ResponseBase } from "../../../core/controllers/http_controller";
|
||||
import { DeleteDataBaseModelUseCase } from "../../../core/usecases/delete_database_model_usecase";
|
||||
import { DeleteRecursiveFolderUseCase } from "../../../core/usecases/delete_recursive_folder_usecase";
|
||||
import { ReadByIdDataBaseModelUseCase } from "../../../core/usecases/read_by_id_database_model_usecase";
|
||||
import { CoreValidation } from "../../../core/validations/core_validation";
|
||||
import { MongoIdValidation } from "../../../core/validations/mongo_id_validation";
|
||||
import { CalculationsTemplateDBModel } from "../models/calculations_template_database_model";
|
||||
import { CalculationsTemplateValidationModel } from "../models/calculations_template_validation_model";
|
||||
|
||||
export class DeleteCalculationsTemplateScenario extends CallbackStrategyWithIdQuery {
|
||||
idValidationExpression: CoreValidation = new MongoIdValidation();
|
||||
call = async (id: string): ResponseBase =>
|
||||
(
|
||||
await new ReadByIdDataBaseModelUseCase<CalculationsTemplateValidationModel>(CalculationsTemplateDBModel).call(id)
|
||||
).map(async (model) => {
|
||||
return (await new DeleteRecursiveFolderUseCase().call(model.path)).map(
|
||||
async () => await new DeleteDataBaseModelUseCase(CalculationsTemplateDBModel).call(id)
|
||||
);
|
||||
});
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
import { ResponseBase } from "../../../core/controllers/http_controller";
|
||||
import { SearchManyDataBaseModelUseCase } from "../../../core/usecases/search_many_database_model_usecase";
|
||||
import { GetActiveProjectIdScenario } from "../../projects/domain/get_active_project_id_scenario";
|
||||
import { ICalculationsTemplateModel, CalculationsTemplateDBModel } from "../models/calculations_template_database_model";
|
||||
|
||||
export class GetAllCalculationsTemplateScenarios {
|
||||
call = async (): ResponseBase =>
|
||||
(await new GetActiveProjectIdScenario().call()).map(
|
||||
async (model) => await new SearchManyDataBaseModelUseCase<ICalculationsTemplateModel>(CalculationsTemplateDBModel).call({ project: model.id })
|
||||
);
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
import { Schema, model } from "mongoose";
|
||||
import { FormBuilderValidationModel, IDatasetModel } from "../../datasets/models/dataset_validation_model";
|
||||
import { IProjectModel, projectSchema } from "../../projects/models/project_model_database_model";
|
||||
|
||||
export interface ICalculationsTemplateModel {
|
||||
path?: string;
|
||||
script: string;
|
||||
formBuilder: FormBuilderValidationModel;
|
||||
type: string;
|
||||
name: string;
|
||||
isEnd: boolean;
|
||||
createDate: Date;
|
||||
card?: string;
|
||||
lastProcessLogs?: string;
|
||||
lastProcessExecCommand?: string;
|
||||
lastExecDate?: Date;
|
||||
processStatus: string;
|
||||
project?: IProjectModel | string;
|
||||
}
|
||||
|
||||
export const CalculationsTemplateSchema = new Schema({
|
||||
script: {
|
||||
type: String,
|
||||
},
|
||||
formBuilder: {
|
||||
type: Schema.Types.Mixed,
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
},
|
||||
name: {
|
||||
type: String,
|
||||
},
|
||||
|
||||
createDate: {
|
||||
type: Number,
|
||||
},
|
||||
card: {
|
||||
type: String,
|
||||
},
|
||||
project: {
|
||||
type: Schema.Types.ObjectId,
|
||||
ref: projectSchema,
|
||||
autopopulate: true,
|
||||
require: true,
|
||||
},
|
||||
path: {
|
||||
type: String,
|
||||
},
|
||||
}).plugin(require("mongoose-autopopulate"));
|
||||
|
||||
export const calculationsTemplateSchema = "calculations_templates";
|
||||
|
||||
export const CalculationsTemplateDBModel = model<ICalculationsTemplateModel>(calculationsTemplateSchema, CalculationsTemplateSchema);
|
|
@ -0,0 +1,27 @@
|
|||
import { IsNotEmpty, IsString, IsMongoId } from "class-validator";
|
||||
import { ICalculationsTemplateModel } from "./calculations_template_database_model";
|
||||
import { FormBuilderValidationModel } from "../../datasets/models/dataset_validation_model";
|
||||
import { IProjectModel } from "../../projects/models/project_model_database_model";
|
||||
|
||||
export class CalculationsTemplateValidationModel implements ICalculationsTemplateModel {
|
||||
processStatus: string;
|
||||
@IsMongoId()
|
||||
project?: string | IProjectModel;
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
script: string;
|
||||
formBuilder: FormBuilderValidationModel;
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
type: string;
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
name: string;
|
||||
isEnd: boolean = true;
|
||||
createDate: Date = new Date();
|
||||
card?: string;
|
||||
lastProcessLogs?: string;
|
||||
lastProcessExecCommand?: string;
|
||||
lastExecDate?: Date;
|
||||
path: string;
|
||||
}
|
|
@ -25,24 +25,22 @@ export class ProcessWatcherAndDatabaseUpdateService<A> extends TypedEvent<
|
|||
event.fold(
|
||||
async (success) => {
|
||||
if (success.event == EXEC_EVENT.END) {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-expect-error
|
||||
const dbModel = await this.model.findById(this.databaseId);
|
||||
if (dbModel !== null) {
|
||||
dbModel.local_path;
|
||||
dbModel.processStatus = ProcessStatus.END;
|
||||
dbModel.processLogs = success.data;
|
||||
dbModel.lastProcessLogs = success.data;
|
||||
await dbModel.save();
|
||||
}
|
||||
}
|
||||
},
|
||||
async (error) => {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-expect-error
|
||||
const dbModel = await this.model.findById(this.databaseId);
|
||||
if (dbModel !== null) {
|
||||
dbModel.processStatus = ProcessStatus.ERROR;
|
||||
dbModel.processLogs = error.message;
|
||||
dbModel.lastProcessLogs = error.message;
|
||||
await dbModel.save();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
import { CallbackStrategyWithIdQuery, ResponseBase } from "../../core/controllers/http_controller";
|
||||
import { Result } from "../../core/helpers/result";
|
||||
import { StaticFiles } from "../../core/models/static_files";
|
||||
import { CreateFileUseCase } from "../../core/usecases/create_file_usecase";
|
||||
import { ReadByIdDataBaseModelUseCase } from "../../core/usecases/read_by_id_database_model_usecase";
|
||||
import { ReadFileAndParseJsonUseCase } from "../../core/usecases/read_file_and_parse_json";
|
||||
import { SearchManyDataBaseModelUseCase } from "../../core/usecases/search_many_database_model_usecase";
|
||||
import { CoreValidation } from "../../core/validations/core_validation";
|
||||
import { MongoIdValidation } from "../../core/validations/mongo_id_validation";
|
||||
import { IProjectModel, ProjectDBModel } from "../projects/models/project_model_database_model";
|
||||
import { SceneAssets, SceneModel } from "./create_new_scene_scenario";
|
||||
import { SceneDBModel } from "./scene_database_model";
|
||||
|
||||
export class ReadSceneScenario extends CallbackStrategyWithIdQuery {
|
||||
idValidationExpression: CoreValidation = new MongoIdValidation();
|
||||
call = async (id: string): ResponseBase =>
|
||||
(await new ReadByIdDataBaseModelUseCase<SceneModel>(SceneDBModel).call(id)).map(async (model) =>
|
||||
(
|
||||
await new SearchManyDataBaseModelUseCase<IProjectModel>(ProjectDBModel).call(
|
||||
{ isActive: true },
|
||||
"is dont active projects"
|
||||
)
|
||||
).map(async (projectModel) => {
|
||||
const { rootDir } = projectModel[0];
|
||||
|
||||
return (await new ReadFileAndParseJsonUseCase().call(`${rootDir}${StaticFiles.scenes}${model.name}.json`)).map(
|
||||
async (sceneAsset) => Result.ok(sceneAsset)
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
import { CrudController } from "../../core/controllers/crud_controller";
|
||||
import { ReadByIdDataBaseModelScenario } from "../../core/scenarios/read_by_id_database_model_scenario";
|
||||
import { BehaviorTreeDBModel } from "../behavior_trees/models/behavior_tree_database_model";
|
||||
import { BehaviorTreeValidationModel } from "../behavior_trees/models/behavior_tree_validation_model";
|
||||
import { CreateNewSceneScenario } from "./create_new_scene_scenario";
|
||||
import { CreateRobotScenario } from "./create_robot_scenario";
|
||||
import { EditSceneScenario } from "./edit_scene_scenario";
|
||||
import { ReadSceneScenario } from "./read_scene_scenario";
|
||||
import { SceneDBModel } from "./scene_database_model";
|
||||
import { SceneValidationModel } from "./scene_validation_model";
|
||||
|
||||
export class ScenePresentation extends CrudController<SceneValidationModel, typeof SceneDBModel> {
|
||||
constructor() {
|
||||
super({
|
||||
url: "scenes",
|
||||
validationModel: SceneValidationModel,
|
||||
databaseModel: SceneDBModel,
|
||||
});
|
||||
|
||||
super.post(new CreateNewSceneScenario().call);
|
||||
super.put(new EditSceneScenario().call);
|
||||
this.subRoutes.push({
|
||||
method: "POST",
|
||||
subUrl: "create/robot",
|
||||
fn: new CreateRobotScenario(),
|
||||
});
|
||||
this.subRoutes.push({
|
||||
method: "GET",
|
||||
subUrl: "by_id",
|
||||
fn: new ReadSceneScenario(),
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,15 +1,12 @@
|
|||
import { IsString } from "class-validator";
|
||||
import { CallbackStrategyWithValidationModel, ResponseBase } from "../../core/controllers/http_controller";
|
||||
import { Result } from "../../core/helpers/result";
|
||||
import { CreateFileUseCase } from "../../core/usecases/create_file_usecase";
|
||||
import { GetActiveProjectIdScenario } from "../projects/domain/get_active_project_id_scenario";
|
||||
import { model } from "mongoose";
|
||||
import { SearchManyDataBaseModelUseCase } from "../../core/usecases/search_many_database_model_usecase";
|
||||
import { IProjectModel, ProjectDBModel } from "../projects/models/project_model_database_model";
|
||||
import { StaticFiles } from "../../core/models/static_files";
|
||||
import { CreateDataBaseModelUseCase } from "../../core/usecases/create_database_model_usecase";
|
||||
import { SceneDBModel } from "./scene_database_model";
|
||||
import { SceneValidationModel } from "./scene_validation_model";
|
||||
import { CallbackStrategyWithValidationModel, ResponseBase } from "../../../core/controllers/http_controller";
|
||||
import { Result } from "../../../core/helpers/result";
|
||||
import { CreateFileUseCase } from "../../../core/usecases/create_file_usecase";
|
||||
import { SearchManyDataBaseModelUseCase } from "../../../core/usecases/search_many_database_model_usecase";
|
||||
import { IProjectModel, ProjectDBModel } from "../../projects/models/project_model_database_model";
|
||||
import { StaticFiles } from "../../../core/models/static_files";
|
||||
import { CreateDataBaseModelUseCase } from "../../../core/usecases/create_database_model_usecase";
|
||||
import { SceneDBModel } from "../model/scene_database_model";
|
||||
export class SceneModel {
|
||||
@IsString()
|
||||
name: string;
|
|
@ -1,11 +1,11 @@
|
|||
import { CallbackStrategyWithValidationModel, ResponseBase } from "../../core/controllers/http_controller";
|
||||
import { Result } from "../../core/helpers/result";
|
||||
import { RobotModel } from "./robot_model";
|
||||
import { StaticFiles } from "../../core/models/static_files";
|
||||
import { GetServerAddressUseCase } from "../../core/usecases/get_server_address_usecase";
|
||||
import { SearchManyDataBaseModelUseCase } from "../../core/usecases/search_many_database_model_usecase";
|
||||
import { IProjectModel, ProjectDBModel } from "../projects/models/project_model_database_model";
|
||||
import { ExecProcessUseCase } from "../../core/usecases/exec_process_usecase";
|
||||
import { CallbackStrategyWithValidationModel, ResponseBase } from "../../../core/controllers/http_controller";
|
||||
import { Result } from "../../../core/helpers/result";
|
||||
import { RobotModel } from "../model/robot_model";
|
||||
import { StaticFiles } from "../../../core/models/static_files";
|
||||
import { GetServerAddressUseCase } from "../../../core/usecases/get_server_address_usecase";
|
||||
import { SearchManyDataBaseModelUseCase } from "../../../core/usecases/search_many_database_model_usecase";
|
||||
import { IProjectModel, ProjectDBModel } from "../../projects/models/project_model_database_model";
|
||||
import { ExecProcessUseCase } from "../../../core/usecases/exec_process_usecase";
|
||||
|
||||
export class CreateRobotScenario extends CallbackStrategyWithValidationModel<RobotModel> {
|
||||
validationModel: RobotModel = new RobotModel();
|
|
@ -1,13 +1,13 @@
|
|||
import { CallbackStrategyWithIdQuery, ResponseBase } from "../../core/controllers/http_controller";
|
||||
import { Result } from "../../core/helpers/result";
|
||||
import { StaticFiles } from "../../core/models/static_files";
|
||||
import { DeleteDataBaseModelUseCase } from "../../core/usecases/delete_database_model_usecase";
|
||||
import { DeleteFileUseCase } from "../../core/usecases/delete_file_usecase";
|
||||
import { ReadByIdDataBaseModelUseCase } from "../../core/usecases/read_by_id_database_model_usecase";
|
||||
import { SearchManyDataBaseModelUseCase } from "../../core/usecases/search_many_database_model_usecase";
|
||||
import { CoreValidation } from "../../core/validations/core_validation";
|
||||
import { MongoIdValidation } from "../../core/validations/mongo_id_validation";
|
||||
import { IProjectModel, ProjectDBModel } from "../projects/models/project_model_database_model";
|
||||
import { CallbackStrategyWithIdQuery, ResponseBase } from "../../../core/controllers/http_controller";
|
||||
import { Result } from "../../../core/helpers/result";
|
||||
import { StaticFiles } from "../../../core/models/static_files";
|
||||
import { DeleteDataBaseModelUseCase } from "../../../core/usecases/delete_database_model_usecase";
|
||||
import { DeleteFileUseCase } from "../../../core/usecases/delete_file_usecase";
|
||||
import { ReadByIdDataBaseModelUseCase } from "../../../core/usecases/read_by_id_database_model_usecase";
|
||||
import { SearchManyDataBaseModelUseCase } from "../../../core/usecases/search_many_database_model_usecase";
|
||||
import { CoreValidation } from "../../../core/validations/core_validation";
|
||||
import { MongoIdValidation } from "../../../core/validations/mongo_id_validation";
|
||||
import { IProjectModel, ProjectDBModel } from "../../projects/models/project_model_database_model";
|
||||
import { SceneModel } from "./create_new_scene_scenario";
|
||||
|
||||
export class DeleteSceneScenario extends CallbackStrategyWithIdQuery {
|
|
@ -1,11 +1,10 @@
|
|||
import { CallbackStrategyWithValidationModel, ResponseBase } from "../../core/controllers/http_controller";
|
||||
import { Result } from "../../core/helpers/result";
|
||||
import { StaticFiles } from "../../core/models/static_files";
|
||||
import { CreateFileUseCase } from "../../core/usecases/create_file_usecase";
|
||||
import { SearchManyDataBaseModelUseCase } from "../../core/usecases/search_many_database_model_usecase";
|
||||
import { IProjectModel, ProjectDBModel } from "../projects/models/project_model_database_model";
|
||||
import { SceneAssets } from "./create_new_scene_scenario";
|
||||
import { SceneValidationModel } from "./scene_validation_model";
|
||||
import { CallbackStrategyWithValidationModel, ResponseBase } from "../../../core/controllers/http_controller";
|
||||
import { Result } from "../../../core/helpers/result";
|
||||
import { StaticFiles } from "../../../core/models/static_files";
|
||||
import { CreateFileUseCase } from "../../../core/usecases/create_file_usecase";
|
||||
import { SearchManyDataBaseModelUseCase } from "../../../core/usecases/search_many_database_model_usecase";
|
||||
import { IProjectModel, ProjectDBModel } from "../../projects/models/project_model_database_model";
|
||||
import { SceneValidationModel } from "../model/scene_validation_model";
|
||||
|
||||
export class EditSceneScenario extends CallbackStrategyWithValidationModel<SceneValidationModel> {
|
||||
validationModel: SceneValidationModel;
|
30
server/src/features/scenes/domain/read_scene_scenario.ts
Normal file
30
server/src/features/scenes/domain/read_scene_scenario.ts
Normal file
|
@ -0,0 +1,30 @@
|
|||
import { CallbackStrategyWithIdQuery, ResponseBase } from "../../../core/controllers/http_controller";
|
||||
import { Result } from "../../../core/helpers/result";
|
||||
import { StaticFiles } from "../../../core/models/static_files";
|
||||
import { ReadByIdDataBaseModelUseCase } from "../../../core/usecases/read_by_id_database_model_usecase";
|
||||
import { ReadFileAndParseJsonUseCase } from "../../../core/usecases/read_file_and_parse_json";
|
||||
import { SearchManyDataBaseModelUseCase } from "../../../core/usecases/search_many_database_model_usecase";
|
||||
import { CoreValidation } from "../../../core/validations/core_validation";
|
||||
import { MongoIdValidation } from "../../../core/validations/mongo_id_validation";
|
||||
import { IProjectModel, ProjectDBModel } from "../../projects/models/project_model_database_model";
|
||||
import { SceneModel } from "./create_new_scene_scenario";
|
||||
import { SceneDBModel } from "../model/scene_database_model";
|
||||
|
||||
export class ReadSceneScenario extends CallbackStrategyWithIdQuery {
|
||||
idValidationExpression: CoreValidation = new MongoIdValidation();
|
||||
call = async (id: string): ResponseBase =>
|
||||
(await new ReadByIdDataBaseModelUseCase<SceneModel>(SceneDBModel).call(id)).map(async (model) =>
|
||||
(
|
||||
await new SearchManyDataBaseModelUseCase<IProjectModel>(ProjectDBModel).call(
|
||||
{ isActive: true },
|
||||
"is dont active projects"
|
||||
)
|
||||
).map(async (projectModel) => {
|
||||
const { rootDir } = projectModel[0];
|
||||
|
||||
return (await new ReadFileAndParseJsonUseCase().call(`${rootDir}${StaticFiles.scenes}${model.name}.json`)).map(
|
||||
async (sceneAsset) => Result.ok(sceneAsset)
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
30
server/src/features/scenes/scenes_presentation.ts
Normal file
30
server/src/features/scenes/scenes_presentation.ts
Normal file
|
@ -0,0 +1,30 @@
|
|||
import { CrudController } from "../../core/controllers/crud_controller";
|
||||
import { CreateNewSceneScenario } from "./domain/create_new_scene_scenario";
|
||||
import { CreateRobotScenario } from "./domain/create_robot_scenario";
|
||||
import { EditSceneScenario } from "./domain/edit_scene_scenario";
|
||||
import { ReadSceneScenario } from "./domain/read_scene_scenario";
|
||||
import { SceneDBModel } from "./model/scene_database_model";
|
||||
import { SceneValidationModel } from "./model/scene_validation_model";
|
||||
|
||||
export class ScenesPresentation extends CrudController<SceneValidationModel, typeof SceneDBModel> {
|
||||
constructor() {
|
||||
super({
|
||||
url: "scenes",
|
||||
validationModel: SceneValidationModel,
|
||||
databaseModel: SceneDBModel,
|
||||
});
|
||||
|
||||
super.post(new CreateNewSceneScenario().call);
|
||||
super.put(new EditSceneScenario().call);
|
||||
this.subRoutes.push({
|
||||
method: "POST",
|
||||
subUrl: "create/robot",
|
||||
fn: new CreateRobotScenario(),
|
||||
});
|
||||
this.subRoutes.push({
|
||||
method: "GET",
|
||||
subUrl: "by_id",
|
||||
fn: new ReadSceneScenario(),
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
import { ObjectId } from "mongoose";
|
||||
import { CallbackStrategyWithIdQuery, ResponseBase } from "../../../core/controllers/http_controller";
|
||||
import { Result } from "../../../core/helpers/result";
|
||||
import { ExecProcessUseCase, IsHaveActiveProcessUseCase } from "../../../core/usecases/exec_process_usecase";
|
||||
import { ReadByIdDataBaseModelUseCase } from "../../../core/usecases/read_by_id_database_model_usecase";
|
||||
import { MongoIdValidation } from "../../../core/validations/mongo_id_validation";
|
||||
import { ProcessWatcherAndDatabaseUpdateService } from "../../datasets/domain/create_dataset_scenario";
|
||||
import { WeightDBModel, IWeightModel } from "../models/weights_validation_model";
|
||||
import { match } from "ts-pattern";
|
||||
import { FolderStructure } from "../../projects/domain/upload_file_to_to_project_scenario";
|
||||
|
||||
export class ExecWeightProcessScenario extends CallbackStrategyWithIdQuery {
|
||||
idValidationExpression = new MongoIdValidation();
|
||||
call = async (id: string): ResponseBase =>
|
||||
(await new ReadByIdDataBaseModelUseCase<IWeightModel>(WeightDBModel).call(id)).map(async (model) => {
|
||||
return (await new IsHaveActiveProcessUseCase().call()).map(async () => {
|
||||
await WeightDBModel.findById(id).updateOne({ processStatus: "RUN" });
|
||||
return match(model.processStatus)
|
||||
.with("exec", "RUN", "none", () => this.exec(id, model))
|
||||
.with('before_training' , () => this.exec(id, model, true))
|
||||
.otherwise(() => Result.error(`model status is ${model.processStatus}`));
|
||||
});
|
||||
});
|
||||
|
||||
exec = (id: string, model: IWeightModel, preTrain?: boolean) =>
|
||||
match(typeof model.project === "object" && typeof model.datasetId === "object")
|
||||
.returnType<ResponseBase>()
|
||||
.with(true, async () => {
|
||||
if (typeof model.project === "object" && typeof model.datasetId === "object") {
|
||||
let execCommand = `python3 $PYTHON_EDUCATION --path ${model.project.rootDir}/${FolderStructure.datasets} --name ${model.name} --datasetName ${model.datasetId.name} --outpath ${model.project.rootDir}/${FolderStructure.weights} --type ${model.datasetId.formBuilder.output.typedataset} --epoch ${model.epoch}`;
|
||||
|
||||
if (preTrain) {
|
||||
execCommand += ` --pretrain`;
|
||||
}
|
||||
return await new ExecProcessUseCase().call(
|
||||
`${model.project.rootDir}/`,
|
||||
execCommand,
|
||||
id,
|
||||
new ProcessWatcherAndDatabaseUpdateService(id as unknown as ObjectId, WeightDBModel)
|
||||
);
|
||||
}
|
||||
})
|
||||
.with(false, async () => Result.error("model is unknown"));
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
import { IsNumber, IsOptional, IsString } from "class-validator";
|
||||
import { IWeightModel } from "./weights_validation_model";
|
||||
|
||||
export class WeightValidationModel implements IWeightModel {
|
||||
public numberOfTrainedEpochs: number;
|
||||
public processStatus: string;
|
||||
@IsNumber()
|
||||
public epoch: number;
|
||||
@IsString()
|
||||
public name: string;
|
||||
public datasetId: string;
|
||||
public project: string;
|
||||
@IsOptional()
|
||||
public isFinished:boolean;
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
import { Schema, model } from "mongoose";
|
||||
import { datasetSchema } from "../../datasets/models/dataset_database_model";
|
||||
import { IDatasetModel } from "../../datasets/models/dataset_validation_model";
|
||||
import { IProjectModel, projectSchema } from "../../projects/models/project_model_database_model";
|
||||
|
||||
export interface IWeightModel {
|
||||
name: string;
|
||||
datasetId: string | IDatasetModel;
|
||||
project: string | IProjectModel;
|
||||
processStatus: string;
|
||||
epoch: number;
|
||||
numberOfTrainedEpochs: number;
|
||||
}
|
||||
export const WeightSchema = new Schema({
|
||||
name: {
|
||||
type: String,
|
||||
},
|
||||
local_path: {
|
||||
type: String,
|
||||
},
|
||||
numberOfTrainedEpochs: {
|
||||
type: Number,
|
||||
default:0,
|
||||
},
|
||||
neuralNetworkName: {
|
||||
type: String,
|
||||
},
|
||||
processStatus: {
|
||||
type: String,
|
||||
default: "none",
|
||||
},
|
||||
|
||||
// the user selects
|
||||
isFinished: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
epoch: {
|
||||
type: Number,
|
||||
},
|
||||
datasetId: {
|
||||
type: Schema.Types.ObjectId,
|
||||
ref: datasetSchema,
|
||||
autopopulate: true,
|
||||
require: true,
|
||||
},
|
||||
project: {
|
||||
type: Schema.Types.ObjectId,
|
||||
ref: projectSchema,
|
||||
autopopulate: true,
|
||||
require: true,
|
||||
},
|
||||
processLogs: {
|
||||
type: String,
|
||||
},
|
||||
}).plugin(require("mongoose-autopopulate"));
|
||||
|
||||
export const weightSchema = "Weight";
|
||||
|
||||
export const WeightDBModel = model<IWeightModel>(weightSchema, WeightSchema);
|
|
@ -1,21 +0,0 @@
|
|||
import { CrudController } from "../../core/controllers/crud_controller";
|
||||
import { ExecWeightProcessScenario } from "./domain/exec_weights_process_scenario";
|
||||
import { GetAllWeightsActiveProjectScenarios } from "./domain/get_all_weights_active_project_scenarios";
|
||||
import { WeightValidationModel } from "./models/weights_database_model";
|
||||
import { WeightDBModel } from "./models/weights_validation_model";
|
||||
|
||||
export class WeightsPresentation extends CrudController<WeightValidationModel, typeof WeightDBModel> {
|
||||
constructor() {
|
||||
super({
|
||||
url: "weights",
|
||||
validationModel: WeightValidationModel,
|
||||
databaseModel: WeightDBModel,
|
||||
});
|
||||
super.get(new GetAllWeightsActiveProjectScenarios().call);
|
||||
this.subRoutes.push({
|
||||
method: "GET",
|
||||
subUrl: "exec",
|
||||
fn: new ExecWeightProcessScenario(),
|
||||
});
|
||||
}
|
||||
}
|
|
@ -9,4 +9,4 @@ extensions();
|
|||
|
||||
const socketSubscribers = [new SocketSubscriber(executorProgramService, "realtime")];
|
||||
|
||||
new App(httpRoutes, socketSubscribers).listen();
|
||||
new App(httpRoutes, socketSubscribers).listen();
|
||||
|
|
|
@ -14,7 +14,7 @@ import { UpdateDataBaseModelUseCaseTest } from "./usecases/update_database_model
|
|||
import { PaginationDataBaseModelUseCaseTest } from "./usecases/pagination_database_model_usecase_test";
|
||||
import { extensions } from "../src/core/extensions/extensions";
|
||||
import { CrudControllerTest } from "./controllers/crud_controller_test";
|
||||
import { TriggerPresentation } from "../src/features/_triggers/triggers_presentation";
|
||||
|
||||
import { App, Environment, ServerStatus } from "../src/core/controllers/app";
|
||||
import { httpRoutes } from "../src/core/controllers/routes";
|
||||
import { DataBaseConnectUseCase } from "../src/core/usecases/database_connect_usecase";
|
||||
|
@ -51,7 +51,7 @@ const unitTest = async () => {
|
|||
testCore.assert(await new usecase().test(), usecase.name);
|
||||
}
|
||||
};
|
||||
const presentationCrudControllers = [new TriggerPresentation()];
|
||||
const presentationCrudControllers = [];
|
||||
const e2eTest = async () => {
|
||||
const app = new App(httpRoutes, [], Environment.E2E_TEST);
|
||||
await new Promise((resolve, reject) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue