mirror of
https://github.com/dadosfera/maestro.git
synced 2026-11-05 11:49:09 +00:00
Prepared Inputs for info params added by auth
This commit is contained in:
@@ -9,8 +9,10 @@ import {
|
||||
} from '@nestjs/common';
|
||||
import { InputsService } from './inputs.service';
|
||||
import { InputsClientService } from 'src/clients/inputs/client.service';
|
||||
import { Payload } from '@nestjs/microservices';
|
||||
import { Info } from 'src/clients/inputs/interfaces';
|
||||
import {
|
||||
ICreateInputRequest,
|
||||
UpdateInputRequest,
|
||||
} from 'src/clients/inputs/interfaces';
|
||||
|
||||
@Controller('inputs')
|
||||
export class InputsController {
|
||||
@@ -29,7 +31,7 @@ export class InputsController {
|
||||
}
|
||||
|
||||
@Post()
|
||||
async create(@Body() createInputDto) {
|
||||
async create(@Body() createInputDto: ICreateInputRequest) {
|
||||
console.log(`/input`, 'ON CREATE ROUTE');
|
||||
|
||||
const inputService = new InputsService(this.inputsClientService);
|
||||
@@ -39,7 +41,7 @@ export class InputsController {
|
||||
}
|
||||
|
||||
@Get()
|
||||
async findAll(@Payload() body: Info) {
|
||||
async findAll(@Body() body) {
|
||||
console.log(process.env.DEV_URL + `/input`, 'ON FIND ALL ROUTE');
|
||||
|
||||
const inputService = new InputsService(this.inputsClientService);
|
||||
@@ -50,7 +52,7 @@ export class InputsController {
|
||||
}
|
||||
|
||||
@Get('/:id')
|
||||
async findOne(@Payload() body, @Param() params) {
|
||||
async findOne(@Body() body, @Param() params) {
|
||||
const { id } = params;
|
||||
console.log(`/input/${id}`, 'ON FIND ONE ROUTE');
|
||||
const inputService = new InputsService(this.inputsClientService);
|
||||
@@ -61,7 +63,7 @@ export class InputsController {
|
||||
}
|
||||
|
||||
@Put(':id')
|
||||
async update(@Payload() updateInputDto, @Param() params) {
|
||||
async update(@Body() updateInputDto: UpdateInputRequest, @Param() params) {
|
||||
const { id } = params;
|
||||
const { info } = updateInputDto;
|
||||
delete updateInputDto.info;
|
||||
@@ -69,20 +71,20 @@ export class InputsController {
|
||||
console.log(`/input/${id}`, 'ON UPDATE ROUTE');
|
||||
const inputService = new InputsService(this.inputsClientService);
|
||||
|
||||
const response = await inputService.update(id, info, updateInputDto);
|
||||
const response = await inputService.update(id, updateInputDto, info);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
@Delete(':id')
|
||||
async delete(@Param() params) {
|
||||
async delete(@Body() data, @Param() params) {
|
||||
const { id } = params;
|
||||
|
||||
console.log(`/input/${id}`, 'ON DELETE ROUTE');
|
||||
|
||||
const inputService = new InputsService(this.inputsClientService);
|
||||
|
||||
const response = await inputService.remove(id);
|
||||
const response = await inputService.remove({ id, ...data });
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user