Add OpenSearch

This commit is contained in:
Victor Radael
2022-07-27 15:54:29 -03:00
parent 22631478b9
commit f65f1d01ce
4 changed files with 42 additions and 16 deletions
+7 -7
View File
@@ -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",
+1 -1
View File
@@ -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",
+8 -2
View File
@@ -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;
@@ -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;
}
}