FIX: data asset owner

This commit is contained in:
Victor Radael
2022-09-30 14:28:06 -03:00
parent 1da61a4c13
commit a8414f780a
3 changed files with 15 additions and 18 deletions
+4 -4
View File
@@ -16,10 +16,10 @@ export class CatalogClientConfiguration {
Catalog.ProtoPackages.ReadPackage,
Catalog.ProtoPackages.WritePackage,
],
credentials:
process.env.LOCAL_ENV || process.env.ENV === 'local'
? undefined
: credentials.createSsl(),
// credentials:
// process.env.LOCAL_ENV || process.env.ENV === 'local'
// ? undefined
// : credentials.createSsl(),
protoPath: [
Catalog.ProtoPaths.ReadFilePath,
Catalog.ProtoPaths.WriteFilePath,
+10 -13
View File
@@ -59,7 +59,6 @@ class CatalogService implements OnModuleInit {
return lastValueFrom(
this.catalogWriteService.ManagePermission(data, metadata),
).catch((err) => {
console.log(err.details);
throw new HttpException(
err.details,
err.code === 6 ? HttpStatus.CONFLICT : 404,
@@ -73,7 +72,6 @@ class CatalogService implements OnModuleInit {
return lastValueFrom(
this.catalogWriteService.RevokePermission(data, metadata),
).catch((err) => {
console.log(err.details);
throw new HttpException(
err.details,
err.code === 6 ? HttpStatus.CONFLICT : 404,
@@ -116,8 +114,6 @@ class CatalogService implements OnModuleInit {
const roles_ids = result.user.roles.map((role) => role.id);
console.log(roles_ids);
return roles_ids;
}
@@ -140,10 +136,11 @@ class CatalogService implements OnModuleInit {
});
for (const asset of response.tables) {
const result =
asset.owner && !asset.owner.includes('@')
? await this.userService.findOneById(asset.owner)
: null;
const condition =
asset.owner && !asset.owner.includes('@') ? true : false;
const result = condition
? await this.userService.findOneById(asset.owner)
: null;
const owner = result !== null ? result.user.username : null;
@@ -151,13 +148,13 @@ class CatalogService implements OnModuleInit {
}
for (const asset of response.dashboards) {
const result =
asset.owner && !asset.owner.includes('@')
? await this.userService.findOneById(asset.owner)
: null;
const condition =
asset.owner && !asset.owner.includes('@') ? true : false;
const result = condition
? await this.userService.findOneById(asset.owner)
: null;
const owner = result !== null ? result.user.username : null;
console.log(asset.owner, result.user.username, owner);
Object.assign(asset, { ...asset, owner });
}