diff --git a/docsfera.json b/docsfera.json index db5d63f..43f40a7 100644 --- a/docsfera.json +++ b/docsfera.json @@ -4828,7 +4828,7 @@ } }, "info": { - "title": "Maestro - main", + "title": "Maestro - feat/trigger-catalog-task", "description": "This is the Maestro API", "version": "1.0.0", "contact": {} @@ -7198,15 +7198,21 @@ "TriggerCatalogReq": { "type": "object", "properties": { - "pipeline_id": { - "type": "string" - }, "table_name": { - "type": "string" + "type": "string", + "description": "Name of the table on Snowflake", + "example": "TB__4DXSD4_TEST" + }, + "table_schema": { + "type": "string", + "description": "Schema where the asset is located. If not set defaults to \"PUBLIC\"" + }, + "pipeline_id": { + "type": "string", + "description": "Id of the pipeline that generated the asset." } }, "required": [ - "pipeline_id", "table_name" ] }, diff --git a/package-lock.json b/package-lock.json index bfb429c..b14caa9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "dependencies": { "@aws-sdk/client-secrets-manager": "^3.112.0", "@dadosfera/dadosfera-logs": "^1.0.0-beta.4", - "@dadosfera/protospack-v2": "3.30.0-beta.2", + "@dadosfera/protospack-v2": "3.30.0-beta.3", "@grpc/grpc-js": "^1.6.7", "@grpc/proto-loader": "^0.6.13", "@nestjs/common": "^8.4.7", @@ -1727,9 +1727,9 @@ } }, "node_modules/@dadosfera/protospack-v2": { - "version": "3.30.0-beta.2", - "resolved": "https://dadosfera-611330257153.d.codeartifact.us-east-1.amazonaws.com:443/npm/dadosfera-npm/@dadosfera/protospack-v2/-/protospack-v2-3.30.0-beta.2.tgz", - "integrity": "sha512-/8LftDebU8Vno07jxSiIXF/D1cxXUuN+wjz+REXiAttRCUbEwK2/kAEpiLu+9gscjdA+Bj1aqmtLcVbvpMQE/w==", + "version": "3.30.0-beta.3", + "resolved": "https://dadosfera-611330257153.d.codeartifact.us-east-1.amazonaws.com:443/npm/dadosfera-npm/@dadosfera/protospack-v2/-/protospack-v2-3.30.0-beta.3.tgz", + "integrity": "sha512-qdSnuhWsU5xNcoKKhPERi2l+jd18eZ+4Ms6LcoLtVakWAgWInrE2VjsFRQuodkU16V0119iMdPR7FGRPjBuxqw==", "dependencies": { "@grpc/grpc-js": "^1.6.7", "rxjs": "^7.5.5", @@ -12287,9 +12287,9 @@ } }, "@dadosfera/protospack-v2": { - "version": "3.30.0-beta.2", - "resolved": "https://dadosfera-611330257153.d.codeartifact.us-east-1.amazonaws.com:443/npm/dadosfera-npm/@dadosfera/protospack-v2/-/protospack-v2-3.30.0-beta.2.tgz", - "integrity": "sha512-/8LftDebU8Vno07jxSiIXF/D1cxXUuN+wjz+REXiAttRCUbEwK2/kAEpiLu+9gscjdA+Bj1aqmtLcVbvpMQE/w==", + "version": "3.30.0-beta.3", + "resolved": "https://dadosfera-611330257153.d.codeartifact.us-east-1.amazonaws.com:443/npm/dadosfera-npm/@dadosfera/protospack-v2/-/protospack-v2-3.30.0-beta.3.tgz", + "integrity": "sha512-qdSnuhWsU5xNcoKKhPERi2l+jd18eZ+4Ms6LcoLtVakWAgWInrE2VjsFRQuodkU16V0119iMdPR7FGRPjBuxqw==", "requires": { "@grpc/grpc-js": "^1.6.7", "rxjs": "^7.5.5", diff --git a/package.json b/package.json index 5caceb7..f2543b8 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "dependencies": { "@aws-sdk/client-secrets-manager": "^3.112.0", "@dadosfera/dadosfera-logs": "^1.0.0-beta.4", - "@dadosfera/protospack-v2": "3.30.0-beta.2", + "@dadosfera/protospack-v2": "3.30.0-beta.3", "@grpc/grpc-js": "^1.6.7", "@grpc/proto-loader": "^0.6.13", "@nestjs/common": "^8.4.7", diff --git a/src/authentication/permissions.enum.ts b/src/authentication/permissions.enum.ts index 4441763..5280795 100644 --- a/src/authentication/permissions.enum.ts +++ b/src/authentication/permissions.enum.ts @@ -346,6 +346,16 @@ export const PERMISSIONS_GROUPS = { 'es-es': 'Acceder al Módulo de Incorporación de Activos', }, }, + TRIGGER_CATALOG_TASK: { + seqid: 45, + claim: 'catalog:trigger-task', + usage: PermissionUsages.INTERNAL, + name: { + 'pt-br': 'Executar a catalogação de um ativo', + 'en-us': 'Trigger an asset cataloging', + 'es-es': 'Realizar el listado de un activo', + }, + }, }, }, diff --git a/src/modules/catalog/catalog.controller.ts b/src/modules/catalog/catalog.controller.ts index 0888949..5f8f96b 100644 --- a/src/modules/catalog/catalog.controller.ts +++ b/src/modules/catalog/catalog.controller.ts @@ -17,6 +17,7 @@ import { import { ApiCreatedResponse, ApiHeaders, ApiTags } from '@nestjs/swagger'; import { Authenticated, + RequireAllPermissions, RequireSomePermission, } from '../../decorators/authentication.decorator'; import { PERMISSIONS_GROUPS } from '../../authentication/permissions.enum'; @@ -583,9 +584,8 @@ export class CatalogController { } @Post('dataset-catalog-task') - @RequireSomePermission( - PERMISSIONS_GROUPS.CATALOG.permissions.UPDATE, - PERMISSIONS_GROUPS.CATALOG.permissions.DATA_MANAGER, + @RequireAllPermissions( + PERMISSIONS_GROUPS.CATALOG.permissions.TRIGGER_CATALOG_TASK, ) @ApiCreatedResponse({ type: TriggerCatalogRes }) async triggerCatalog( @@ -605,9 +605,8 @@ export class CatalogController { } @Get('dataset-catalog-task/:session') - @RequireSomePermission( - PERMISSIONS_GROUPS.CATALOG.permissions.UPDATE, - PERMISSIONS_GROUPS.CATALOG.permissions.DATA_MANAGER, + @RequireAllPermissions( + PERMISSIONS_GROUPS.CATALOG.permissions.TRIGGER_CATALOG_TASK, ) @ApiCreatedResponse({ type: TriggerCatalogRes }) async getCatalogTask( diff --git a/src/modules/catalog/dtos/index.ts b/src/modules/catalog/dtos/index.ts index a8b11e3..d7d135f 100644 --- a/src/modules/catalog/dtos/index.ts +++ b/src/modules/catalog/dtos/index.ts @@ -273,10 +273,22 @@ export class IColumnsMetadataResponse { } export class TriggerCatalogReq { - @ApiProperty() - pipeline_id: string; - @ApiProperty() + @ApiProperty({ + description: 'Name of the table on Snowflake', + example: 'TB__4DXSD4_TEST', + }) table_name: string; + + @ApiPropertyOptional({ + description: + 'Schema where the asset is located. If not set defaults to "PUBLIC"', + }) + table_schema?: string; + + @ApiPropertyOptional({ + description: 'Id of the pipeline that generated the asset.', + }) + pipeline_id: string; } export class TriggerCatalogRes {