mirror of
https://github.com/dadosfera/maestro.git
synced 2026-11-17 02:19:08 +00:00
Add OpenSearch
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user