mirror of
https://github.com/dadosfera/maestro.git
synced 2026-11-15 05:19:09 +00:00
FIX: Delete data asset
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user