mirror of
https://github.com/dadosfera/maestro.git
synced 2026-11-09 05:49:07 +00:00
FIX: Manage Permissions Catalog
This commit is contained in:
@@ -55,8 +55,19 @@ export class CatalogController {
|
||||
@User() user: RequestUser,
|
||||
@Body() body,
|
||||
) {
|
||||
const response = await this.catalogService.managePermissions(body, user);
|
||||
return { message: { id, body } };
|
||||
const { customer_id, customer_name, user_id, username } = user;
|
||||
const metadata = PackTheMetadata({
|
||||
customer_id,
|
||||
customer_name,
|
||||
user_id,
|
||||
username,
|
||||
});
|
||||
const response = await this.catalogService.managePermissions(
|
||||
{ ...body, id },
|
||||
metadata,
|
||||
);
|
||||
|
||||
return { data_asset: JSON.parse(response.data_asset) };
|
||||
}
|
||||
|
||||
@Get('all')
|
||||
|
||||
@@ -3,7 +3,12 @@ import { ReadService } from '@dadosfera/protospack-v2/dist/lib/Catalog';
|
||||
import { ProtoServices } from '@dadosfera/protospack-v2/dist/lib/Catalog';
|
||||
import { Messages } from '@dadosfera/protospack-v2/dist/lib/Catalog';
|
||||
import { WriteService } from '@dadosfera/protospack-v2/dist/lib/Catalog';
|
||||
import { Inject, OnModuleInit } from '@nestjs/common';
|
||||
import {
|
||||
HttpException,
|
||||
HttpStatus,
|
||||
Inject,
|
||||
OnModuleInit,
|
||||
} from '@nestjs/common';
|
||||
import { ClientGrpc } from '@nestjs/microservices';
|
||||
import axios from 'axios';
|
||||
import { lastValueFrom } from 'rxjs';
|
||||
@@ -47,21 +52,17 @@ class CatalogService implements OnModuleInit {
|
||||
}
|
||||
|
||||
async managePermissions(data: Messages.ManagePermissionRequest, metadata) {
|
||||
this.logger.info('CatalogService - getAllOpenSearchDashboard');
|
||||
this.logger.info('CatalogService - Manage Data assets permissions');
|
||||
|
||||
const response = await lastValueFrom(
|
||||
return lastValueFrom(
|
||||
this.catalogWriteService.ManagePermission(data, metadata),
|
||||
)
|
||||
.then((res) => {
|
||||
this.logger.info('Done');
|
||||
return res;
|
||||
})
|
||||
.catch((err) => {
|
||||
this.logger.error(err.message);
|
||||
throw new Error(err);
|
||||
});
|
||||
|
||||
return { data_assets: response };
|
||||
).catch((err) => {
|
||||
console.log(err.details);
|
||||
throw new HttpException(
|
||||
err.details,
|
||||
err.code === 6 ? HttpStatus.CONFLICT : 404,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
async catalogAll(body) {
|
||||
|
||||
Reference in New Issue
Block a user