get entities

This commit is contained in:
Gabriel Rosa
2022-06-14 14:01:40 -03:00
parent ff663e7166
commit 383741f48c
4 changed files with 37 additions and 4 deletions
+22 -1
View File
@@ -1,4 +1,9 @@
import { OnModuleInit, Inject, HttpException } from '@nestjs/common';
import {
OnModuleInit,
Inject,
HttpException,
HttpStatus,
} from '@nestjs/common';
import { ClientGrpc } from '@nestjs/microservices';
import {
DecodeGrpcStruct,
@@ -268,4 +273,20 @@ export class InputsClientService implements OnModuleInit {
// getOauthTokens(input){
// }
async getAvailableEntities(data) {
console.log('InputClientService', 'GetAvailableEntities');
objectSnakeToCamel(data);
const response = await lastValueFrom(
this.inputService.GetAvailableEntities(data),
).catch((err) => {
console.log(err);
if (err.details && err.details.includes('400'))
throw new HttpException('Plugin inválido', HttpStatus.BAD_REQUEST);
throw new HttpException(err.details, HttpStatus.INTERNAL_SERVER_ERROR);
});
objectCamelToSnake(response);
return response;
}
}