mirror of
https://github.com/dadosfera/maestro.git
synced 2026-10-29 04:09:09 +00:00
FEAT: remove custom properties endpoints and DTOs from catalog management
This commit is contained in:
@@ -37,7 +37,6 @@ import { PackTheMetadata } from 'src/utils/PackTheMetadata';
|
||||
import { RequestUser, User } from 'src/decorators/user.decorator';
|
||||
import {
|
||||
BatchRemoveRlsRulesRequest,
|
||||
CustomPropertyDefinitionDto,
|
||||
GetDatasetCatalogTaskRes,
|
||||
ICatalogAllRequest,
|
||||
ICatalogAllResponse,
|
||||
@@ -289,49 +288,6 @@ export class CatalogController {
|
||||
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,
|
||||
|
||||
@@ -35,11 +35,9 @@ import {
|
||||
} from './dtos';
|
||||
import {
|
||||
AddRlsRuleRequest,
|
||||
DeleteCustomPropertyDefinitionRequest,
|
||||
GetNimbusDashboardsRequest,
|
||||
GetRlsRulesRequest,
|
||||
PiiMetadata,
|
||||
UpsertCustomPropertyDefinitionRequest,
|
||||
} from '@dadosfera/protospack-v2/dist/lib/Catalog/interfaces/messages';
|
||||
import { TypeParser } from 'src/utils/FileParser/parser-types';
|
||||
import { ParserBuilder } from 'src/utils/FileParser/parser.builder';
|
||||
@@ -126,20 +124,6 @@ class CatalogService implements OnModuleInit {
|
||||
return lastValueFrom(this.catalogReadService.GetCustomPropertyDefinitions({}, metadata));
|
||||
}
|
||||
|
||||
async upsertCustomPropertyDefinition(
|
||||
data: UpsertCustomPropertyDefinitionRequest,
|
||||
metadata: Metadata,
|
||||
) {
|
||||
return lastValueFrom(this.catalogWriteService.UpsertCustomPropertyDefinition(data, metadata));
|
||||
}
|
||||
|
||||
async deleteCustomPropertyDefinition(
|
||||
data: DeleteCustomPropertyDefinitionRequest,
|
||||
metadata: Metadata,
|
||||
) {
|
||||
return lastValueFrom(this.catalogWriteService.DeleteCustomPropertyDefinition(data, metadata));
|
||||
}
|
||||
|
||||
async createDataAsset(data: Messages.CreateDataAssetRequest, metadata) {
|
||||
this.logger.info('CatalogService - Manage Data assets permissions');
|
||||
if (!data.embed) data.embed = undefined;
|
||||
|
||||
@@ -203,21 +203,6 @@ export class IData {
|
||||
day_opening: number;
|
||||
}
|
||||
|
||||
export type CustomPropertyType = 'text' | 'number' | 'boolean' | 'date';
|
||||
|
||||
export class CustomPropertyDefinitionDto {
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
key?: string;
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
name: string;
|
||||
@ApiProperty({ enum: ['text', 'number', 'boolean', 'date'] })
|
||||
@IsEnum(['text', 'number', 'boolean', 'date'])
|
||||
type: CustomPropertyType;
|
||||
}
|
||||
|
||||
export class IUpdateDataRequest {
|
||||
@ApiProperty()
|
||||
@@ -233,7 +218,7 @@ export class IUpdateDataRequest {
|
||||
@ApiPropertyOptional()
|
||||
docs?: string;
|
||||
@ApiPropertyOptional()
|
||||
custom_properties?: Record<string, string | number | boolean | null>;
|
||||
custom_properties?: Record<string, (string | number | boolean)[]>;
|
||||
}
|
||||
|
||||
export class IUpdateCertificationStatusRequest {
|
||||
|
||||
Reference in New Issue
Block a user