mirror of
https://github.com/dadosfera/maestro.git
synced 2026-10-19 10:29:08 +00:00
REFACTOR: Add Auth Validators
This commit is contained in:
@@ -7,15 +7,13 @@ import {
|
||||
Post,
|
||||
Put,
|
||||
} from '@nestjs/common';
|
||||
import axios from 'axios';
|
||||
import { InputsService } from './inputs.service';
|
||||
import { InputsClientService } from 'src/clients/inputs/client.service';
|
||||
import { Payload } from '@nestjs/microservices';
|
||||
|
||||
@Controller('input')
|
||||
@Controller('inputs')
|
||||
export class InputsController {
|
||||
|
||||
constructor( private inputsClientService:InputsClientService){}
|
||||
constructor(private inputsClientService: InputsClientService) {}
|
||||
|
||||
@Get('/test-connection')
|
||||
async testConnection(@Body() data) {
|
||||
@@ -23,11 +21,11 @@ export class InputsController {
|
||||
process.env.DEV_URL + `/test-connection`,
|
||||
'ON TEST CONNECTION ROUTE',
|
||||
);
|
||||
|
||||
console.log(data)
|
||||
|
||||
const inputService = new InputsService(this.inputsClientService)
|
||||
const response = await inputService.testConnection(data)
|
||||
console.log(data);
|
||||
|
||||
const inputService = new InputsService(this.inputsClientService);
|
||||
const response = await inputService.testConnection(data);
|
||||
|
||||
return response;
|
||||
}
|
||||
@@ -36,8 +34,8 @@ export class InputsController {
|
||||
async create(@Body() createInputDto) {
|
||||
console.log(process.env.DEV_URL + `/input`, 'ON CREATE ROUTE');
|
||||
|
||||
const inputService = new InputsService(this.inputsClientService)
|
||||
const response = await inputService.create(createInputDto)
|
||||
const inputService = new InputsService(this.inputsClientService);
|
||||
const response = await inputService.create(createInputDto);
|
||||
|
||||
return response;
|
||||
}
|
||||
@@ -46,53 +44,46 @@ export class InputsController {
|
||||
async findAll() {
|
||||
console.log(process.env.DEV_URL + `/input`, 'ON FIND ALL ROUTE');
|
||||
|
||||
const inputService = new InputsService(this.inputsClientService)
|
||||
const inputService = new InputsService(this.inputsClientService);
|
||||
|
||||
const response = await inputService.findAll()
|
||||
const response = await inputService.findAll();
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
@Get('/:id')
|
||||
async findOne(@Param() params) {
|
||||
const { id } = params
|
||||
const { id } = params;
|
||||
console.log(process.env.DEV_URL + `/input/${id}`, 'ON FIND ONE ROUTE');
|
||||
const inputService = new InputsService(this.inputsClientService)
|
||||
|
||||
const response = await inputService.findOne(id)
|
||||
const inputService = new InputsService(this.inputsClientService);
|
||||
|
||||
const response = await inputService.findOne(id);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
@Put(':id')
|
||||
async update(
|
||||
@Payload() updateInputDto,
|
||||
@Param() params,
|
||||
) {
|
||||
|
||||
const {id} = params;
|
||||
async update(@Payload() updateInputDto, @Param() params) {
|
||||
const { id } = params;
|
||||
|
||||
console.log(process.env.DEV_URL + `/input/${id}`, 'ON UPDATE ROUTE');
|
||||
const inputService = new InputsService(this.inputsClientService)
|
||||
const inputService = new InputsService(this.inputsClientService);
|
||||
|
||||
const response = await inputService.update(id,updateInputDto)
|
||||
const response = await inputService.update(id, updateInputDto);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
@Delete(':id')
|
||||
async delete(@Param() params) {
|
||||
const { id } = params;
|
||||
|
||||
const {id} = params
|
||||
|
||||
console.log(process.env.DEV_URL + `/input/${id}`, 'ON DELETE ROUTE');
|
||||
|
||||
const inputService = new InputsService(this.inputsClientService)
|
||||
const inputService = new InputsService(this.inputsClientService);
|
||||
|
||||
const response = await inputService.remove(id)
|
||||
const response = await inputService.remove(id);
|
||||
|
||||
return response;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user