mirror of
https://github.com/dadosfera/maestro.git
synced 2026-10-16 18:29:07 +00:00
UPGRADE: Added LOgs lib
This commit is contained in:
@@ -3,6 +3,7 @@ import {
|
||||
Controller,
|
||||
Delete,
|
||||
Get,
|
||||
Inject,
|
||||
Param,
|
||||
Post,
|
||||
Put,
|
||||
@@ -11,16 +12,27 @@ import { Payload } from '@nestjs/microservices';
|
||||
import { TransformationsClientService } from 'src/clients/transformations/client.service';
|
||||
import { IIdRequest } from 'src/clients/transformations/interfaces';
|
||||
import { TransformationsService } from './transformations.service';
|
||||
|
||||
import { DadosferaLogger } from 'dadosfera-logs';
|
||||
@Controller('transformations')
|
||||
export class TransformationsController {
|
||||
logger: any;
|
||||
constructor(
|
||||
@Inject(DadosferaLogger)
|
||||
dadosferaLogger: DadosferaLogger,
|
||||
private transformationsClientService: TransformationsClientService,
|
||||
) {}
|
||||
) {
|
||||
this.logger = dadosferaLogger.logger;
|
||||
}
|
||||
|
||||
@Post()
|
||||
async create(@Body() createTransformationDto) {
|
||||
console.log(process.env.DEV_URL + `/transformation`, 'ON CREATE ROUTE');
|
||||
this.logger.info(
|
||||
process.env.DEV_URL + `/transformation - ON CREATE ROUTE`,
|
||||
{
|
||||
user: createTransformationDto.info.user_id,
|
||||
customer: createTransformationDto.info.customer,
|
||||
},
|
||||
);
|
||||
|
||||
const transformationService = new TransformationsService(
|
||||
this.transformationsClientService,
|
||||
@@ -34,7 +46,13 @@ export class TransformationsController {
|
||||
|
||||
@Get()
|
||||
async findAll(@Body() data: IIdRequest) {
|
||||
console.log(process.env.DEV_URL + `/transformation`, 'ON Find All ROUTE');
|
||||
this.logger.info(
|
||||
process.env.DEV_URL + `/transformation - ON Find All ROUTE`,
|
||||
{
|
||||
user: data.info.user_id,
|
||||
customer: data.info.customer_id,
|
||||
},
|
||||
);
|
||||
|
||||
const transformationService = new TransformationsService(
|
||||
this.transformationsClientService,
|
||||
@@ -47,9 +65,12 @@ export class TransformationsController {
|
||||
@Get('/:id')
|
||||
async findOne(@Body() data, @Param() params) {
|
||||
const { id } = params;
|
||||
console.log(
|
||||
process.env.DEV_URL + `/transformation/${id}`,
|
||||
'ON Find One ROUTE',
|
||||
this.logger.info(
|
||||
process.env.DEV_URL + `/transformation/${id} - ON Find One ROUTE`,
|
||||
{
|
||||
user: data.info.user_id,
|
||||
customer: data.info.customer,
|
||||
},
|
||||
);
|
||||
|
||||
const transformationService = new TransformationsService(
|
||||
@@ -63,9 +84,12 @@ export class TransformationsController {
|
||||
@Put(':id')
|
||||
async update(@Payload() updateTransformationDto, @Param() params) {
|
||||
const { id } = params;
|
||||
console.log(
|
||||
process.env.DEV_URL + `/transformation/${id}`,
|
||||
'ON UPDATE ROUTE',
|
||||
this.logger.info(
|
||||
process.env.DEV_URL + `/transformation/${id} - ON UPDATE ROUTE`,
|
||||
{
|
||||
user: updateTransformationDto.info.user_id,
|
||||
customer: updateTransformationDto.info.customer,
|
||||
},
|
||||
);
|
||||
|
||||
const transformationService = new TransformationsService(
|
||||
@@ -82,9 +106,12 @@ export class TransformationsController {
|
||||
@Delete(':id')
|
||||
async delete(@Body() data, @Param() params) {
|
||||
const { id } = params;
|
||||
console.log(
|
||||
process.env.DEV_URL + `/transformation/${id}`,
|
||||
'ON DELETE ROUTE',
|
||||
this.logger.info(
|
||||
process.env.DEV_URL + `/transformation/${id} - ON DELETE ROUTE`,
|
||||
{
|
||||
user: data.info.user_id,
|
||||
customer: data.info.customer,
|
||||
},
|
||||
);
|
||||
|
||||
const transformationService = new TransformationsService(
|
||||
|
||||
Reference in New Issue
Block a user