FIX: Delete data asset

This commit is contained in:
Victor Radael
2022-10-26 14:22:29 -03:00
parent b64619ede1
commit dfa6222538
3 changed files with 36 additions and 1 deletions
+22
View File
@@ -454,6 +454,28 @@ export class CatalogController {
return response;
}
@Delete('data-asset/:id')
async deleteDataAsset(
@Param('id') data_asset_id: string,
@User() user: RequestUser,
) {
const { customer_id, customer_name, user_id, username } = user;
const metadata = PackTheMetadata({
customer_id,
customer_name,
user_id,
username,
});
const [type, id] = data_asset_id.split('-');
const response = await this.catalogService.deleteDataAsset(
{ id, type },
metadata,
);
return response;
}
@Delete('data-asset/:id/comment')
async deleteComment(
@Param('id') id: string,
+13
View File
@@ -110,6 +110,19 @@ class CatalogService implements OnModuleInit {
});
}
async deleteDataAsset(data: Messages.DeleteDataAssetRequest, metadata) {
this.logger.info('CatalogService - Manage Data assets permissions');
return lastValueFrom(
this.catalogWriteService.DeleteDataAsset(data, metadata),
).catch((err) => {
throw new HttpException(
err.details,
err.code === 6 ? HttpStatus.CONFLICT : 404,
);
});
}
async getUserRolesIds(userId: string) {
const result = await this.userService.findOneById(userId).catch(() => null);