FIX: create input generic adjusted to new pipeline format

This commit is contained in:
Gabriel Rosa
2022-09-06 08:38:46 -03:00
parent 5e0a422b35
commit 31e9a07489
6 changed files with 115 additions and 201 deletions
+9 -15
View File
@@ -105,24 +105,18 @@ export class InputsController {
@Post()
@ApiOkResponse({ type: Input })
async create(@Body() createInputDto: CreateInputReq) {
async create(@Body() body: CreateInputReq, @User() user: RequestUser) {
const info: Info = {
user_id: user.user_id,
customer: user.customer_name,
customer_id: user.customer_id,
};
this.logger.info(`/input - ON CREATE ROUTE`, {
user: createInputDto.info.user_id,
customer: createInputDto.info.customer,
user: info.user_id,
customer: info.customer,
});
const response = await this.inputService.create(createInputDto);
return response;
}
@Post(':id')
@ApiOkResponse({ type: Input })
async reCreate(@Param('id') id: string, @Body() input: CreateInputReq) {
if (!input.id) input.id = id;
this.logger.info(`POST /${id}`, 'ON RECREATE ROUTE');
const response = await this.inputService.reCreate(input);
const response = await this.inputService.create({ body, info });
return response;
}