diff --git a/package-lock.json b/package-lock.json index 4f59365..1ab9eb4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -38,7 +38,7 @@ "passport-hubspot-oauth2": "^1.0.3", "passport-mailchimp": "^1.1.0", "protospack": "2.5.2", - "protospack-v2": "3.8.13", + "protospack-v2": "3.8.14", "reflect-metadata": "^0.1.13", "rimraf": "^3.0.2", "rxjs": "^7.5.5", @@ -9018,9 +9018,9 @@ } }, "node_modules/protospack-v2": { - "version": "3.8.13", - "resolved": "https://dadosfera-611330257153.d.codeartifact.us-east-1.amazonaws.com:443/npm/dadosfera-npm/protospack-v2/-/protospack-v2-3.8.13.tgz", - "integrity": "sha512-arUr08PAMB5Qkz/5W1VR/czKGOYgHZA3nJmoWzhJTjuCn1kSMVdIHMPLfpUC49IJPkgYXCjUy0ehEwWUj4BAZA==", + "version": "3.8.14", + "resolved": "https://dadosfera-611330257153.d.codeartifact.us-east-1.amazonaws.com:443/npm/dadosfera-npm/protospack-v2/-/protospack-v2-3.8.14.tgz", + "integrity": "sha512-wGJ32RR/F62cpXB0EihSvh/rnFCvzsb97vebbOKbVkg9ykUVT6yXUeHYC62eqYB20fOyuReRbUW+tyM5AJL94Q==", "dependencies": { "@grpc/grpc-js": "^1.6.7", "rxjs": "^7.5.5", @@ -17247,9 +17247,9 @@ } }, "protospack-v2": { - "version": "3.8.13", - "resolved": "https://dadosfera-611330257153.d.codeartifact.us-east-1.amazonaws.com:443/npm/dadosfera-npm/protospack-v2/-/protospack-v2-3.8.13.tgz", - "integrity": "sha512-arUr08PAMB5Qkz/5W1VR/czKGOYgHZA3nJmoWzhJTjuCn1kSMVdIHMPLfpUC49IJPkgYXCjUy0ehEwWUj4BAZA==", + "version": "3.8.14", + "resolved": "https://dadosfera-611330257153.d.codeartifact.us-east-1.amazonaws.com:443/npm/dadosfera-npm/protospack-v2/-/protospack-v2-3.8.14.tgz", + "integrity": "sha512-wGJ32RR/F62cpXB0EihSvh/rnFCvzsb97vebbOKbVkg9ykUVT6yXUeHYC62eqYB20fOyuReRbUW+tyM5AJL94Q==", "requires": { "@grpc/grpc-js": "^1.6.7", "rxjs": "^7.5.5", diff --git a/package.json b/package.json index 0c63618..95e42ae 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "passport-hubspot-oauth2": "^1.0.3", "passport-mailchimp": "^1.1.0", "protospack": "2.5.2", - "protospack-v2": "3.8.13", + "protospack-v2": "3.8.14", "reflect-metadata": "^0.1.13", "rimraf": "^3.0.2", "rxjs": "^7.5.5", diff --git a/src/modules/connection/client.service.ts b/src/modules/connection/client.service.ts index 32f5303..f342a55 100644 --- a/src/modules/connection/client.service.ts +++ b/src/modules/connection/client.service.ts @@ -70,6 +70,7 @@ export class ConnectionClientService implements OnModuleInit { meta.add('customer_id', info.customer_id); meta.add('customer_name', info.customer_name); meta.add('user_id', info.user_id); + meta.add('language', info.language); const { id, @@ -130,11 +131,15 @@ export class ConnectionClientService implements OnModuleInit { meta.add('customer_id', info.customer_id); meta.add('customer_name', info.customer_name); meta.add('user_id', info.user_id); + meta.add('language', info.language); - const { id } = body; + const { search, filters, size, page } = body; return lastValueFrom( - this.connectionServiceRead.GetAllConnection({}, meta), + this.connectionServiceRead.GetAllConnection( + { search, filters: JSON.stringify(filters), size, page }, + meta, + ), ).catch((err) => { throw new HttpException( err.details, @@ -148,6 +153,7 @@ export class ConnectionClientService implements OnModuleInit { meta.add('customer_id', info.customer_id); meta.add('customer_name', info.customer_name); meta.add('user_id', info.user_id); + meta.add('language', info.language); const { id } = body; diff --git a/src/modules/connection/connection.controller.ts b/src/modules/connection/connection.controller.ts index 20b2705..f95dbf5 100644 --- a/src/modules/connection/connection.controller.ts +++ b/src/modules/connection/connection.controller.ts @@ -7,6 +7,8 @@ import { Param, Delete, Get, + Headers, + Query, } from '@nestjs/common'; import { ApiBearerAuth, ApiTags } from '@nestjs/swagger'; import { ConnectionClientService } from './client.service'; @@ -64,6 +66,7 @@ export class ConnectionController { // @RequireAllPermissions(Permissions.CONNECTIONS.CREATE) async updateConnection( @User() user, + @Headers('Dadosfera-Lang') language, @Param('id') id, @Body(new ValidationPipe()) body: UpdateConnectionDto, ) { @@ -73,7 +76,7 @@ export class ConnectionController { const response = await this.clientService.updateConnection({ body: { ...body, id }, - info: { user_id, customer_id, customer_name }, + info: { user_id, customer_id, customer_name, language }, }); delete response.connection.properties; @@ -108,14 +111,19 @@ export class ConnectionController { @Get() // @RequireAllPermissions(Permissions.CONNECTIONS.CREATE) - async getAllConnection(@User() user) { + async getAllConnection( + @User() user, + @Headers('Dadosfera-Lang') language, + @Query() queries, + ) { this.logger.info('/connections - Get All Connection'); const { user_id, customer_id, customer_name } = user; + const { search, size, page, ...filters } = queries; const response = await this.clientService.getAllConnection({ - body: {}, - info: { user_id, customer_id, customer_name }, + body: { search, size, page, filters }, + info: { user_id, customer_id, customer_name, language }, }); return response; @@ -123,14 +131,18 @@ export class ConnectionController { @Get('/:id') // @RequireAllPermissions(Permissions.CONNECTIONS.CREATE) - async getConnection(@User() user, @Param('id') id) { + async getConnection( + @User() user, + @Headers('Dadosfera-Lang') language, + @Param('id') id, + ) { this.logger.info('/connections - Get Connection'); const { user_id, customer_id, customer_name } = user; const response = await this.clientService.getConnection({ body: { id }, - info: { user_id, customer_id, customer_name }, + info: { user_id, customer_id, customer_name, language }, }); delete response.connection.user_id; @@ -153,6 +165,14 @@ export class ConnectionController { info: { user_id, customer_id, customer_name }, }); + delete response.connection.user_id; + delete response.connection.customer_id; + delete response.connection.customer_name; + + Object.assign(response.connection, { + properties: JSON.parse(response.connection.properties), + }); + return response; } }