mirror of
https://github.com/dadosfera/maestro.git
synced 2026-11-11 13:59:08 +00:00
FEAT: add custom properties endpoints and DTOs for catalog management
This commit is contained in:
@@ -37,6 +37,7 @@ import { PackTheMetadata } from 'src/utils/PackTheMetadata';
|
||||
import { RequestUser, User } from 'src/decorators/user.decorator';
|
||||
import {
|
||||
BatchRemoveRlsRulesRequest,
|
||||
CustomPropertyDefinitionDto,
|
||||
GetDatasetCatalogTaskRes,
|
||||
ICatalogAllRequest,
|
||||
ICatalogAllResponse,
|
||||
@@ -271,6 +272,66 @@ export class CatalogController {
|
||||
|
||||
}
|
||||
|
||||
@Get('custom-properties')
|
||||
@RequireSomePermission(
|
||||
PERMISSIONS_GROUPS.CATALOG.permissions.GET,
|
||||
PERMISSIONS_GROUPS.CATALOG.permissions.DATA_MANAGER,
|
||||
)
|
||||
async getCustomPropertyDefinitions(@User() user: RequestUser) {
|
||||
const { customer_id, customer_name, user_id, username } = user;
|
||||
const metadata = PackTheMetadata({
|
||||
customer_id,
|
||||
customer_name,
|
||||
user_id,
|
||||
username,
|
||||
});
|
||||
|
||||
return this.catalogService.getCustomPropertyDefinitions(metadata);
|
||||
}
|
||||
|
||||
@Post('custom-properties')
|
||||
@RequireAllPermissions(PERMISSIONS_GROUPS.CATALOG.permissions.DATA_MANAGER)
|
||||
async upsertCustomPropertyDefinition(
|
||||
@User() user: RequestUser,
|
||||
@Body() definition: CustomPropertyDefinitionDto,
|
||||
) {
|
||||
const { customer_id, customer_name, user_id, username } = user;
|
||||
const metadata = PackTheMetadata({
|
||||
customer_id,
|
||||
customer_name,
|
||||
user_id,
|
||||
username,
|
||||
});
|
||||
|
||||
return this.catalogService.upsertCustomPropertyDefinition(
|
||||
{
|
||||
definition: {
|
||||
key: definition.key || '',
|
||||
name: definition.name,
|
||||
type: definition.type,
|
||||
},
|
||||
},
|
||||
metadata,
|
||||
);
|
||||
}
|
||||
|
||||
@Delete('custom-properties/:key')
|
||||
@RequireAllPermissions(PERMISSIONS_GROUPS.CATALOG.permissions.DATA_MANAGER)
|
||||
async deleteCustomPropertyDefinition(
|
||||
@User() user: RequestUser,
|
||||
@Param('key') key: string,
|
||||
) {
|
||||
const { customer_id, customer_name, user_id, username } = user;
|
||||
const metadata = PackTheMetadata({
|
||||
customer_id,
|
||||
customer_name,
|
||||
user_id,
|
||||
username,
|
||||
});
|
||||
|
||||
return this.catalogService.deleteCustomPropertyDefinition({ key }, metadata);
|
||||
}
|
||||
|
||||
@Get('data-asset/:id')
|
||||
@RequireSomePermission(
|
||||
PERMISSIONS_GROUPS.CATALOG.permissions.GET,
|
||||
@@ -1002,4 +1063,4 @@ export class CatalogController {
|
||||
this.logger.error(error.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user