mirror of
https://github.com/dadosfera/maestro.git
synced 2026-09-29 05:34:48 +00:00
maestro connection with microservices - clients and modules
This commit is contained in:
@@ -1,83 +1,79 @@
|
||||
// import {
|
||||
// Body,
|
||||
// Controller,
|
||||
// Delete,
|
||||
// Get,
|
||||
// Param,
|
||||
// Post,
|
||||
// Put,
|
||||
// Redirect,
|
||||
// } from '@nestjs/common';
|
||||
// import { Payload } from '@nestjs/microservices';
|
||||
// import axios from 'axios';
|
||||
// import { Console } from 'console';
|
||||
// // import { CreateInputGrpcClientDto } from './dto/create-input-grpc-client.dto';
|
||||
// // import { UpdateInputGrpcClientDto } from './dto/update-input-grpc-client.dto';
|
||||
import {
|
||||
Body,
|
||||
Controller,
|
||||
Delete,
|
||||
Get,
|
||||
Param,
|
||||
Post,
|
||||
Put,
|
||||
Redirect,
|
||||
} from '@nestjs/common';
|
||||
import { Payload } from '@nestjs/microservices';
|
||||
import { TransformationsClientService } from 'src/clients/transformations/client.service';
|
||||
import { TransformationsService } from './transformations.service';
|
||||
|
||||
// @Controller('transformations')
|
||||
// export class TransformationsController {
|
||||
// @Get('/test-connection')
|
||||
// async testConnection() {
|
||||
// console.log(
|
||||
// process.env.DEV_URL + `/test-connection`,
|
||||
// 'ON TEST CONNECTION ROUTE',
|
||||
// );
|
||||
// await axios
|
||||
// .get(process.env.DEV_URL + `/test-connection`)
|
||||
// .then((response) => {
|
||||
// return response;
|
||||
// });
|
||||
// }
|
||||
@Controller('transformations')
|
||||
export class TransformationsController {
|
||||
|
||||
// @Post()
|
||||
// async create(@Body() createInputDto: CreateInputGrpcClientDto) {
|
||||
// console.log(createInputDto);
|
||||
// console.log(process.env.DEV_URL + `/input`, 'ON CREATE ROUTE');
|
||||
constructor( private transformationsClientService:TransformationsClientService){}
|
||||
|
||||
// await axios
|
||||
// .post(process.env.DEV_URL + '/input', createInputDto)
|
||||
// .then((response) => {
|
||||
// return response;
|
||||
// });
|
||||
// }
|
||||
|
||||
// @Get()
|
||||
// async list() {
|
||||
// console.log(process.env.DEV_URL + `/input`, 'ON GET ROUTE');
|
||||
// await axios.get(process.env.DEV_URL + `/input`).then((response) => {
|
||||
// return response;
|
||||
// });
|
||||
// }
|
||||
|
||||
// @Get('/:id')
|
||||
// async show(@Param() id: string) {
|
||||
// console.log(process.env.DEV_URL + `/input/${id}`, 'ON SHOW ROUTE');
|
||||
// await axios.get(process.env.DEV_URL + `/input/${id}`).then((response) => {
|
||||
// return response;
|
||||
// });
|
||||
// }
|
||||
|
||||
// @Put(':id')
|
||||
// async update(
|
||||
// @Payload() updateInputDto: UpdateInputGrpcClientDto,
|
||||
// @Param() id: string,
|
||||
// ) {
|
||||
// console.log(process.env.DEV_URL + `/input/${id}`, 'ON UPDATE ROUTE');
|
||||
// await axios
|
||||
// .put(process.env.DEV_URL + `input/${id}`, updateInputDto)
|
||||
// .then((response) => {
|
||||
// return response;
|
||||
// });
|
||||
// }
|
||||
|
||||
// @Delete(':id')
|
||||
// async delete(@Param() id: string) {
|
||||
// console.log(process.env.DEV_URL + `/input/${id}`, 'ON DELETE ROUTE');
|
||||
|
||||
// await axios
|
||||
// .delete(process.env.DEV_URL + `/input/${id}`)
|
||||
// .then((response) => {
|
||||
// return response;
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
@Post()
|
||||
async create(@Body() createTransformationDto) {
|
||||
console.log(process.env.DEV_URL + `/transformation`, 'ON CREATE ROUTE');
|
||||
|
||||
const transformationService = new TransformationsService(this.transformationsClientService)
|
||||
const response = await transformationService.create(createTransformationDto)
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
@Get()
|
||||
async findAll() {
|
||||
console.log(process.env.DEV_URL + `/transformation`, 'ON Find All ROUTE');
|
||||
|
||||
const transformationService = new TransformationsService(this.transformationsClientService)
|
||||
const response = await transformationService.findAll()
|
||||
|
||||
return response;
|
||||
|
||||
}
|
||||
|
||||
@Get('/:id')
|
||||
async findOne(@Param() params) {
|
||||
const {id} = params;
|
||||
console.log(process.env.DEV_URL + `/transformation/${id}`, 'ON Find One ROUTE');
|
||||
|
||||
const transformationService = new TransformationsService(this.transformationsClientService)
|
||||
const response = await transformationService.findOne(id)
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
@Put(':id')
|
||||
async update(
|
||||
@Payload() updateTransformationDto,
|
||||
@Param() params,
|
||||
) {
|
||||
const {id} = params;
|
||||
console.log(process.env.DEV_URL + `/transformation/${id}`, 'ON UPDATE ROUTE');
|
||||
|
||||
const transformationService = new TransformationsService(this.transformationsClientService)
|
||||
const response = await transformationService.update(id,updateTransformationDto)
|
||||
|
||||
return response;
|
||||
|
||||
}
|
||||
|
||||
@Delete(':id')
|
||||
async delete(@Param() params) {
|
||||
const {id} = params;
|
||||
console.log(process.env.DEV_URL + `/transformation/${id}`, 'ON DELETE ROUTE');
|
||||
|
||||
const transformationService = new TransformationsService(this.transformationsClientService)
|
||||
const response = await transformationService.remove(id)
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user