change http controller
This commit is contained in:
parent
fa645dde92
commit
f746039ee5
4 changed files with 123 additions and 21 deletions
|
@ -1,9 +1,15 @@
|
|||
import { CrudController } from "../../core/controllers/crud_controller";
|
||||
import {
|
||||
CallbackStrategyWithEmpty,
|
||||
ResponseBase,
|
||||
} from "../../core/controllers/http_controller";
|
||||
import { Result } from "../../core/helper/result";
|
||||
import { CreateNewProjectInstanceScenario } from "./create_new_project_scenario";
|
||||
import {
|
||||
ProjectInstanceDbModel,
|
||||
ProjectInstanceValidationModel,
|
||||
} from "./project_instance_model";
|
||||
import { UploadCadFileToProjectUseCase } from "./upload_file_to_project_usecase";
|
||||
|
||||
export class ProjectInstancePresentation extends CrudController<
|
||||
ProjectInstanceValidationModel,
|
||||
|
@ -16,8 +22,19 @@ export class ProjectInstancePresentation extends CrudController<
|
|||
databaseModel: ProjectInstanceDbModel,
|
||||
});
|
||||
super.post(new CreateNewProjectInstanceScenario().call);
|
||||
// super.router.post(this.mainURL + "/file", (req, res) => {
|
||||
// TODO:
|
||||
// });
|
||||
|
||||
super.subRoutes = [
|
||||
{
|
||||
method: "post",
|
||||
subUrl: "upload",
|
||||
fn: new TestUseCase(),
|
||||
},
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
class TestUseCase extends CallbackStrategyWithEmpty {
|
||||
async call(): ResponseBase {
|
||||
return Result.ok(200);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
import {
|
||||
CallbackStrategyWithFileUpload,
|
||||
ResponseBase,
|
||||
} from "../../core/controllers/http_controller";
|
||||
import { Result } from "../../core/helper/result";
|
||||
|
||||
export class UploadCadFileToProjectUseCase extends CallbackStrategyWithFileUpload {
|
||||
checkingFileExpression: RegExp = RegExp('.FCStd')
|
||||
async call(file: File): ResponseBase {
|
||||
|
||||
return Result.ok("200");
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue