FEAT: inputs and transformation using protospack-v2

This commit is contained in:
Gabriel Rosa
2022-08-16 10:18:54 -03:00
parent 5f17a7106f
commit 6807b3e1a9
9 changed files with 343 additions and 331 deletions
@@ -8,7 +8,6 @@ import {
Post,
Put,
} from '@nestjs/common';
import { Payload } from '@nestjs/microservices';
import { ApiTags } from '@nestjs/swagger';
import { TransformationsClientService } from './client.service';
import { IIdRequest } from './interfaces';
@@ -16,6 +15,7 @@ import { AuthenticateCondition } from 'src/authentication/authentication.decorat
import { PERMISSIONS } from '../../authentication/permissions.enum';
import { TransformationsService } from './transformations.service';
import { DadosferaLogger } from '@dadosfera/dadosfera-logs';
import { RequestUser, User } from 'src/authentication/user.decorator';
@ApiTags('Transformations')
@Controller('transformations')
@@ -51,13 +51,10 @@ export class TransformationsController {
@Post()
async create(@Body() createTransformationDto) {
this.logger.info(
process.env.DEV_URL + `/transformation - ON CREATE ROUTE`,
{
user: createTransformationDto.info.user_id,
customer: createTransformationDto.info.customer,
},
);
this.logger.info(`/transformation - ON CREATE ROUTE`, {
user: createTransformationDto.info.user_id,
customer: createTransformationDto.info.customer,
});
const transformationService = new TransformationsService(
this.transformationsClientService,
@@ -71,13 +68,10 @@ export class TransformationsController {
@Get()
async findAll(@Body() data: IIdRequest) {
this.logger.info(
process.env.DEV_URL + `/transformation - ON Find All ROUTE`,
{
user: data.info.user_id,
customer: data.info.customer_id,
},
);
this.logger.info(`/transformation - ON Find All ROUTE`, {
user: data.info.user_id,
customer: data.info.customer_id,
});
const transformationService = new TransformationsService(
this.transformationsClientService,
@@ -90,13 +84,10 @@ export class TransformationsController {
@Get('/:id')
async findOne(@Body() data, @Param() params) {
const { id } = params;
this.logger.info(
process.env.DEV_URL + `/transformation/${id} - ON Find One ROUTE`,
{
user: data.info.user_id,
customer: data.info.customer,
},
);
this.logger.info(`/transformation/${id} - ON Find One ROUTE`, {
user: data.info.user_id,
customer: data.info.customer,
});
const transformationService = new TransformationsService(
this.transformationsClientService,
@@ -107,15 +98,15 @@ export class TransformationsController {
}
@Put(':id')
async update(@Payload() updateTransformationDto, @Param() params) {
const { id } = params;
this.logger.info(
process.env.DEV_URL + `/transformation/${id} - ON UPDATE ROUTE`,
{
user: updateTransformationDto.info.user_id,
customer: updateTransformationDto.info.customer,
},
);
async update(
@User() user: RequestUser,
@Body() updateTransformationDto,
@Param('id') id: string,
) {
this.logger.info(`/transformation/${id} - ON UPDATE ROUTE`, {
user: user.user_id,
customer: user.customer_name,
});
const transformationService = new TransformationsService(
this.transformationsClientService,
@@ -131,13 +122,10 @@ export class TransformationsController {
@Delete(':id')
async delete(@Body() data, @Param() params) {
const { id } = params;
this.logger.info(
process.env.DEV_URL + `/transformation/${id} - ON DELETE ROUTE`,
{
user: data.info.user_id,
customer: data.info.customer,
},
);
this.logger.info(`/transformation/${id} - ON DELETE ROUTE`, {
user: data.info.user_id,
customer: data.info.customer,
});
const transformationService = new TransformationsService(
this.transformationsClientService,