Merge pull request #211 from dadosfera/feat/trigger-catalog-task

Feat/trigger catalog task
This commit is contained in:
Gabriel Amorim
2023-03-17 12:14:15 -03:00
committed by GitHub
13 changed files with 782 additions and 62 deletions
+278 -3
View File
@@ -241,7 +241,16 @@
},
"get": {
"operationId": "ConnectionController_getConnectionDetails",
"parameters": [],
"parameters": [
{
"name": "id",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "",
@@ -449,7 +458,16 @@
"/inputs/{id}": {
"get": {
"operationId": "InputsController_findOne",
"parameters": [],
"parameters": [
{
"name": "id",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "",
@@ -646,6 +664,14 @@
],
"type": "string"
}
},
{
"name": "id",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"responses": {
@@ -678,6 +704,14 @@
],
"type": "string"
}
},
{
"name": "id",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"responses": {
@@ -710,6 +744,14 @@
],
"type": "string"
}
},
{
"name": "id",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"responses": {
@@ -749,6 +791,14 @@
],
"type": "string"
}
},
{
"name": "id",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"responses": {
@@ -786,6 +836,14 @@
],
"type": "string"
}
},
{
"name": "id",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"responses": {
@@ -823,6 +881,14 @@
],
"type": "string"
}
},
{
"name": "id",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"responses": {
@@ -985,6 +1051,14 @@
"type": "string"
}
},
{
"name": "id",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
},
{
"name": "shared",
"required": true,
@@ -1025,6 +1099,14 @@
],
"type": "string"
}
},
{
"name": "id",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"requestBody": {
@@ -1125,6 +1207,14 @@
],
"type": "string"
}
},
{
"name": "id",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"responses": {
@@ -1167,6 +1257,14 @@
],
"type": "string"
}
},
{
"name": "id",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"responses": {
@@ -1209,6 +1307,14 @@
],
"type": "string"
}
},
{
"name": "id",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"responses": {
@@ -1402,6 +1508,108 @@
]
}
},
"/catalog/dataset-catalog-task": {
"post": {
"operationId": "CatalogController_triggerCatalog",
"parameters": [
{
"name": "dadosfera-lang",
"in": "header",
"required": false,
"schema": {
"enum": [
"pt-br",
"en-us"
],
"type": "string"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TriggerCatalogReq"
}
}
}
},
"responses": {
"201": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TriggerCatalogRes"
}
}
}
}
},
"tags": [
"Catalog"
],
"security": [
{
"access-token": []
},
{
"access-token": []
}
]
}
},
"/catalog/dataset-catalog-task/{session}": {
"get": {
"operationId": "CatalogController_getCatalogTask",
"parameters": [
{
"name": "dadosfera-lang",
"in": "header",
"required": false,
"schema": {
"enum": [
"pt-br",
"en-us"
],
"type": "string"
}
},
{
"name": "session",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/GetDatasetCatalogTaskRes"
}
}
}
}
},
"tags": [
"Catalog"
],
"security": [
{
"access-token": []
},
{
"access-token": []
}
]
}
},
"/oauth/hubspot": {
"get": {
"operationId": "OauthController_oauthHubspot",
@@ -1544,7 +1752,7 @@
}
},
"info": {
"title": "Maestro - fix/delete-connector",
"title": "Maestro - feat/trigger-catalog-task",
"description": "This is the Maestro API",
"version": "1.0.0",
"contact": {}
@@ -2842,6 +3050,73 @@
"required": [
"comment"
]
},
"TriggerCatalogReq": {
"type": "object",
"properties": {
"table_name": {
"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": [
"table_name"
]
},
"TriggerCatalogRes": {
"type": "object",
"properties": {
"session": {
"type": "string"
}
},
"required": [
"session"
]
},
"GetDatasetCatalogTaskRes": {
"type": "object",
"properties": {
"created_at": {
"type": "string"
},
"customer_name": {
"type": "string"
},
"session_id": {
"type": "string"
},
"status": {
"type": "string"
},
"table_name": {
"type": "string"
},
"updated_at": {
"type": "string"
},
"updated_by": {
"type": "string"
}
},
"required": [
"created_at",
"customer_name",
"session_id",
"status",
"table_name",
"updated_at",
"updated_by"
]
}
}
}
+332 -6
View File
@@ -690,7 +690,16 @@
},
"get": {
"operationId": "ConnectionController_getConnectionDetails",
"parameters": [],
"parameters": [
{
"name": "id",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "",
@@ -2574,7 +2583,16 @@
"/inputs/{id}": {
"get": {
"operationId": "InputsController_findOne",
"parameters": [],
"parameters": [
{
"name": "id",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "",
@@ -2819,6 +2837,14 @@
],
"type": "string"
}
},
{
"name": "id",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"responses": {
@@ -2851,6 +2877,14 @@
],
"type": "string"
}
},
{
"name": "id",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"responses": {
@@ -2883,6 +2917,14 @@
],
"type": "string"
}
},
{
"name": "id",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"responses": {
@@ -2922,6 +2964,14 @@
],
"type": "string"
}
},
{
"name": "id",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"responses": {
@@ -2959,6 +3009,14 @@
],
"type": "string"
}
},
{
"name": "id",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"responses": {
@@ -2999,6 +3057,14 @@
],
"type": "string"
}
},
{
"name": "id",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"responses": {
@@ -3036,6 +3102,14 @@
],
"type": "string"
}
},
{
"name": "id",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"responses": {
@@ -3217,6 +3291,14 @@
],
"type": "string"
}
},
{
"name": "id",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"responses": {
@@ -3247,7 +3329,16 @@
"summary": "",
"deprecated": true,
"description": "This method is deprecated. Please use route /pipelinesV2/start/:id instead",
"parameters": [],
"parameters": [
{
"name": "id",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"responses": {
"201": {
"description": "",
@@ -3279,7 +3370,16 @@
"summary": "",
"deprecated": true,
"description": "This method is deprecated. Please use route /pipelinesV2/:id/status instead",
"parameters": [],
"parameters": [
{
"name": "id",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "",
@@ -3350,7 +3450,16 @@
"/transformations/{id}": {
"get": {
"operationId": "TransformationsController_findOne",
"parameters": [],
"parameters": [
{
"name": "id",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "",
@@ -3658,6 +3767,14 @@
"type": "string"
}
},
{
"name": "id",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
},
{
"name": "shared",
"required": true,
@@ -3698,6 +3815,14 @@
],
"type": "string"
}
},
{
"name": "id",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"requestBody": {
@@ -3798,6 +3923,14 @@
],
"type": "string"
}
},
{
"name": "id",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"responses": {
@@ -3833,6 +3966,14 @@
],
"type": "string"
}
},
{
"name": "id",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"responses": {
@@ -3875,6 +4016,14 @@
],
"type": "string"
}
},
{
"name": "id",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"responses": {
@@ -3917,6 +4066,14 @@
],
"type": "string"
}
},
{
"name": "id",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"responses": {
@@ -4190,6 +4347,108 @@
]
}
},
"/catalog/dataset-catalog-task": {
"post": {
"operationId": "CatalogController_triggerCatalog",
"parameters": [
{
"name": "dadosfera-lang",
"in": "header",
"required": false,
"schema": {
"enum": [
"pt-br",
"en-us"
],
"type": "string"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TriggerCatalogReq"
}
}
}
},
"responses": {
"201": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TriggerCatalogRes"
}
}
}
}
},
"tags": [
"Catalog"
],
"security": [
{
"access-token": []
},
{
"access-token": []
}
]
}
},
"/catalog/dataset-catalog-task/{session}": {
"get": {
"operationId": "CatalogController_getCatalogTask",
"parameters": [
{
"name": "dadosfera-lang",
"in": "header",
"required": false,
"schema": {
"enum": [
"pt-br",
"en-us"
],
"type": "string"
}
},
{
"name": "session",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/GetDatasetCatalogTaskRes"
}
}
}
}
},
"tags": [
"Catalog"
],
"security": [
{
"access-token": []
},
{
"access-token": []
}
]
}
},
"/terms-of-use/token": {
"get": {
"operationId": "TermsOfUseController_getToken",
@@ -4716,7 +4975,7 @@
}
},
"info": {
"title": "Maestro - fix/delete-connector",
"title": "Maestro - feat/trigger-catalog-task",
"description": "This is the Maestro API",
"version": "1.0.0",
"contact": {}
@@ -7083,6 +7342,73 @@
"comment"
]
},
"TriggerCatalogReq": {
"type": "object",
"properties": {
"table_name": {
"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": [
"table_name"
]
},
"TriggerCatalogRes": {
"type": "object",
"properties": {
"session": {
"type": "string"
}
},
"required": [
"session"
]
},
"GetDatasetCatalogTaskRes": {
"type": "object",
"properties": {
"created_at": {
"type": "string"
},
"customer_name": {
"type": "string"
},
"session_id": {
"type": "string"
},
"status": {
"type": "string"
},
"table_name": {
"type": "string"
},
"updated_at": {
"type": "string"
},
"updated_by": {
"type": "string"
}
},
"required": [
"created_at",
"customer_name",
"session_id",
"status",
"table_name",
"updated_at",
"updated_by"
]
},
"ConnectionTestPingReq": {
"type": "object",
"properties": {
+32 -23
View File
@@ -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.29.1",
"@dadosfera/protospack-v2": "3.30.0",
"@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.29.1",
"resolved": "https://dadosfera-611330257153.d.codeartifact.us-east-1.amazonaws.com:443/npm/dadosfera-npm/@dadosfera/protospack-v2/-/protospack-v2-3.29.1.tgz",
"integrity": "sha512-uVswwXltdG0aX8cYVSFPRcROPWjOlW5bJGFfn5RNodKyHeBiTVDWBB3/YgocKrWV4mYBSbZ11ctBzjSAOkf/0Q==",
"version": "3.30.0",
"resolved": "https://dadosfera-611330257153.d.codeartifact.us-east-1.amazonaws.com:443/npm/dadosfera-npm/@dadosfera/protospack-v2/-/protospack-v2-3.30.0.tgz",
"integrity": "sha512-00wqZyZmjd6rMECga2S3Ow0dk6c5fZoWd6Th+Ajofq6q/kycTU66p/5xdf0sPf//WyXMGCXasqGSZa0h9i01vg==",
"dependencies": {
"@grpc/grpc-js": "^1.6.7",
"rxjs": "^7.5.5",
@@ -4495,9 +4495,10 @@
"license": "MIT"
},
"node_modules/cookiejar": {
"version": "2.1.3",
"dev": true,
"license": "MIT"
"version": "2.1.4",
"resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.4.tgz",
"integrity": "sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw==",
"dev": true
},
"node_modules/core-util-is": {
"version": "1.0.3",
@@ -7759,9 +7760,10 @@
"license": "ISC"
},
"node_modules/json5": {
"version": "2.2.1",
"version": "2.2.3",
"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz",
"integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==",
"dev": true,
"license": "MIT",
"bin": {
"json5": "lib/cli.js"
},
@@ -7968,9 +7970,9 @@
}
},
"node_modules/luxon": {
"version": "1.28.0",
"resolved": "https://registry.npmjs.org/luxon/-/luxon-1.28.0.tgz",
"integrity": "sha512-TfTiyvZhwBYM/7QdAVDh+7dBTBA29v4ik0Ce9zda3Mnf8on1S5KJI8P2jKFZ8+5C0jhmr0KwJEO/Wdpm0VeWJQ==",
"version": "1.28.1",
"resolved": "https://registry.npmjs.org/luxon/-/luxon-1.28.1.tgz",
"integrity": "sha512-gYHAa180mKrNIUJCbwpmD0aTu9kV0dREDrwNnuyFAsO1Wt0EVYSZelPnJlbj9HplzXX/YWXHFTL45kvZ53M0pw==",
"engines": {
"node": "*"
}
@@ -10384,9 +10386,10 @@
}
},
"node_modules/tsconfig-paths/node_modules/json5": {
"version": "1.0.1",
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz",
"integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==",
"dev": true,
"license": "MIT",
"dependencies": {
"minimist": "^1.2.0"
},
@@ -12284,9 +12287,9 @@
}
},
"@dadosfera/protospack-v2": {
"version": "3.29.1",
"resolved": "https://dadosfera-611330257153.d.codeartifact.us-east-1.amazonaws.com:443/npm/dadosfera-npm/@dadosfera/protospack-v2/-/protospack-v2-3.29.1.tgz",
"integrity": "sha512-uVswwXltdG0aX8cYVSFPRcROPWjOlW5bJGFfn5RNodKyHeBiTVDWBB3/YgocKrWV4mYBSbZ11ctBzjSAOkf/0Q==",
"version": "3.30.0",
"resolved": "https://dadosfera-611330257153.d.codeartifact.us-east-1.amazonaws.com:443/npm/dadosfera-npm/@dadosfera/protospack-v2/-/protospack-v2-3.30.0.tgz",
"integrity": "sha512-00wqZyZmjd6rMECga2S3Ow0dk6c5fZoWd6Th+Ajofq6q/kycTU66p/5xdf0sPf//WyXMGCXasqGSZa0h9i01vg==",
"requires": {
"@grpc/grpc-js": "^1.6.7",
"rxjs": "^7.5.5",
@@ -14190,7 +14193,9 @@
"version": "1.0.6"
},
"cookiejar": {
"version": "2.1.3",
"version": "2.1.4",
"resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.4.tgz",
"integrity": "sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw==",
"dev": true
},
"core-util-is": {
@@ -16399,7 +16404,9 @@
"dev": true
},
"json5": {
"version": "2.2.1",
"version": "2.2.3",
"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz",
"integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==",
"dev": true
},
"jsonc-parser": {
@@ -16548,9 +16555,9 @@
}
},
"luxon": {
"version": "1.28.0",
"resolved": "https://registry.npmjs.org/luxon/-/luxon-1.28.0.tgz",
"integrity": "sha512-TfTiyvZhwBYM/7QdAVDh+7dBTBA29v4ik0Ce9zda3Mnf8on1S5KJI8P2jKFZ8+5C0jhmr0KwJEO/Wdpm0VeWJQ=="
"version": "1.28.1",
"resolved": "https://registry.npmjs.org/luxon/-/luxon-1.28.1.tgz",
"integrity": "sha512-gYHAa180mKrNIUJCbwpmD0aTu9kV0dREDrwNnuyFAsO1Wt0EVYSZelPnJlbj9HplzXX/YWXHFTL45kvZ53M0pw=="
},
"macos-release": {
"version": "2.5.0",
@@ -18138,7 +18145,9 @@
},
"dependencies": {
"json5": {
"version": "1.0.1",
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz",
"integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==",
"dev": true,
"requires": {
"minimist": "^1.2.0"
+1 -1
View File
@@ -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.29.1",
"@dadosfera/protospack-v2": "3.30.0",
"@grpc/grpc-js": "^1.6.7",
"@grpc/proto-loader": "^0.6.13",
"@nestjs/common": "^8.4.7",
+10
View File
@@ -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',
},
},
},
},
+62 -8
View File
@@ -14,9 +14,15 @@ import {
Query,
UseFilters,
} from '@nestjs/common';
import { ApiHeaders, ApiTags } from '@nestjs/swagger';
import {
ApiCreatedResponse,
ApiHeaders,
ApiOkResponse,
ApiTags,
} from '@nestjs/swagger';
import {
Authenticated,
RequireAllPermissions,
RequireSomePermission,
} from '../../decorators/authentication.decorator';
import { PERMISSIONS_GROUPS } from '../../authentication/permissions.enum';
@@ -25,6 +31,7 @@ import { DadosferaLogger } from '@dadosfera/dadosfera-logs';
import { PackTheMetadata } from 'src/utils/ PackTheMetadata';
import { RequestUser, User } from 'src/decorators/user.decorator';
import {
GetDatasetCatalogTaskRes,
ICatalogAllRequest,
ICatalogAllResponse,
IColumnsMetadataResponse,
@@ -35,6 +42,8 @@ import {
IOneDataAsset,
IPreviewResponse,
IUpdateDataRequest,
TriggerCatalogReq,
TriggerCatalogRes,
} from './dtos';
import { GrpcToHttpExceptionFilter } from 'src/error/grpc-to-http-exception.filter';
import { Language } from 'src/decorators/language.decorator';
@@ -180,7 +189,7 @@ export class CatalogController {
)
async getDataAsset(
@User() user: RequestUser,
@Param('id') id,
@Param('id') id: string,
@Query('shared') shared?: 'true',
) {
const { username, user_id, customer_id, customer_name, permissions } = user;
@@ -196,7 +205,7 @@ export class CatalogController {
let has_permission = false;
const metadata = PackTheMetadata({
username,
user_id: undefined,
user_id,
customer_id,
customer_name,
});
@@ -237,7 +246,7 @@ export class CatalogController {
async getDataAssetRls(
@User() user: RequestUser,
@Headers() headers,
@Param('id') id,
@Param('id') id: string,
) {
const { username, user_id, customer_id, customer_name, permissions } = user;
@@ -292,7 +301,7 @@ export class CatalogController {
async getDataAssetColumnsMetadata(
@User() user: RequestUser,
@Language() language: LanguageEnum,
@Param('id') id,
@Param('id') id: string,
): Promise<IColumnsMetadataResponse> {
const { customer_name, customer_id, user_id, username } = user;
@@ -323,7 +332,7 @@ export class CatalogController {
async getDataAssetPreview(
@User() user: RequestUser,
@Language() language: LanguageEnum,
@Param('id') id,
@Param('id') id: string,
): Promise<IPreviewResponse> {
const { customer_name, customer_id, user_id, username } = user;
@@ -353,7 +362,7 @@ export class CatalogController {
async getDataAssetDocs(
@User() user: RequestUser,
@Language() language: LanguageEnum,
@Param('id') id,
@Param('id') id: string,
): Promise<IDocsResponse> {
const { customer_name, customer_id, user_id, username } = user;
@@ -383,7 +392,7 @@ export class CatalogController {
async updateDataAsset(
@User() user: RequestUser,
@Language() language: LanguageEnum,
@Param('id') data_asset_id,
@Param('id') data_asset_id: string,
@Body() body: IUpdateDataRequest,
): Promise<IOneDataAsset> {
const { customer_id, customer_name, user_id, username } = user;
@@ -579,4 +588,49 @@ export class CatalogController {
return response;
}
@Post('dataset-catalog-task')
@RequireAllPermissions(
PERMISSIONS_GROUPS.CATALOG.permissions.TRIGGER_CATALOG_TASK,
)
@ApiCreatedResponse({ type: TriggerCatalogRes })
async triggerCatalog(
@User() user: RequestUser,
@Body() body: TriggerCatalogReq,
) {
const { customer_id, customer_name, user_id, username } = user;
const metadata = PackTheMetadata({
customer_id,
customer_name,
user_id,
username,
});
const session = await this.catalogService.triggerCatalog(body, metadata);
return { session };
}
@Get('dataset-catalog-task/:session')
@RequireAllPermissions(
PERMISSIONS_GROUPS.CATALOG.permissions.TRIGGER_CATALOG_TASK,
)
@ApiOkResponse({ type: GetDatasetCatalogTaskRes })
async getCatalogTask(
@User() user: RequestUser,
@Param('session') session: string,
) {
const { customer_id, customer_name, user_id, username } = user;
const metadata = PackTheMetadata({
customer_id,
customer_name,
user_id,
username,
});
const response = await this.catalogService.getDatasetCatalogTask(
session,
metadata,
);
return response;
}
}
+13 -1
View File
@@ -18,7 +18,7 @@ import { CatalogClientConfiguration } from './catalog-client';
import { UsersService } from '../users/users.service';
import { RolesService } from '../roles/roles.service';
import { Metadata } from '@grpc/grpc-js';
import { IUpdateDataRequest } from './dtos';
import { IUpdateDataRequest, TriggerCatalogReq } from './dtos';
class CatalogService implements OnModuleInit {
catalogReadService: ReadService.CatalogReadServices;
@@ -333,6 +333,18 @@ class CatalogService implements OnModuleInit {
} as typeof data_asset;
});
}
async triggerCatalog(data: TriggerCatalogReq, metadata: Metadata) {
const { session } = await lastValueFrom(
this.catalogWriteService.TriggerDatasetCataloging(data, metadata),
);
return session;
}
async getDatasetCatalogTask(session: string, metadata: Metadata) {
const res = await lastValueFrom(
this.catalogReadService.GetDatasetCatalogTask({ session }, metadata),
);
return res;
}
}
export { CatalogService };
+41
View File
@@ -271,3 +271,44 @@ export class IColumnsMetadataResponse {
@ApiProperty({ type: [IColumnMetadata] })
columns_metadata: IColumnMetadata[];
}
export class TriggerCatalogReq {
@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 {
@ApiProperty()
session: string;
}
export class GetDatasetCatalogTaskRes {
@ApiProperty()
created_at: string;
@ApiProperty()
customer_name: string;
@ApiProperty()
session_id: string;
@ApiProperty()
status: string;
@ApiProperty()
table_name: string;
@ApiProperty()
updated_at: string;
@ApiProperty()
updated_by: string;
}
@@ -164,7 +164,7 @@ export class ConnectionController {
async getConnectionDetails(
@Language() language: LanguageEnum,
@User() user: RequestUser,
@Param('id') id,
@Param('id') id: string,
@Query() queries,
): Promise<ConnectionDetailsRes> {
this.logger.info('/connections - Get Connection Details');
+1 -2
View File
@@ -123,8 +123,7 @@ export class InputsController {
}
@Get('/:id')
async findOne(@Body() body, @Param() params) {
const { id } = params;
async findOne(@Body() body, @Param('id') id: string) {
this.logger.info(`/input/${id} - ON FIND ONE ROUTE`, {
user: body.info.user_id,
customer: body.info.customer,
@@ -49,8 +49,7 @@ export class PipelinesController {
description:
'This method is deprecated. Please use route /pipelinesV2/start/:id instead',
})
async activate(@Param() params, @Body() body) {
const { id } = params;
async activate(@Param('id') id: string, @Body() body) {
const { info } = body;
this.logger.info(
@@ -72,8 +71,7 @@ export class PipelinesController {
description:
'This method is deprecated. Please use route /pipelinesV2/:id/status instead',
})
async getPipelineStatus(@Body() body, @Param() params) {
const { id } = params;
async getPipelineStatus(@Body() body, @Param('id') id: string) {
body.id = id;
this.logger.info(
@@ -170,7 +170,7 @@ export class PipelinesController {
async getPipelineproperties(
@Language() language: LanguageEnum,
@User() user: RequestUser,
@Param('id') id,
@Param('id') id: string,
) {
this.logger.info('PipelinesController - getPipelineproperties', { user });
const metadata = PackTheMetadata({ ...user, language: language });
@@ -181,7 +181,7 @@ export class PipelinesController {
async getPipelineObjects(
@Language() language: LanguageEnum,
@User() user: RequestUser,
@Param('id') id,
@Param('id') id: string,
) {
this.logger.info('PipelinesController - getPipelineObjects', { user });
const metadata = PackTheMetadata({ ...user, language: language });
@@ -189,8 +189,7 @@ export class PipelinesController {
}
@Get(':id/status')
async getPipelineStatus(@Body() body, @Param() params) {
const { id } = params;
async getPipelineStatus(@Body() body, @Param('id') id: string) {
body.id = id;
this.logger.info(
@@ -210,7 +209,7 @@ export class PipelinesController {
async findOne(
@Language() language: LanguageEnum,
@User() user: RequestUser,
@Param('id') id,
@Param('id') id: string,
): Promise<Messages.PipelineV2FindOneResponse> {
this.logger.info('PipelinesController - findOne', { user });
@@ -251,7 +250,7 @@ export class PipelinesController {
async update(
@Language() language: LanguageEnum,
@Body() updatePipelineDto,
@Param('id') id,
@Param('id') id: string,
@User() user: RequestUser,
) {
this.logger.info('PipelinesController - update', { user });
@@ -290,7 +289,7 @@ export class PipelinesController {
async updateDeprecated(
@Language() language: LanguageEnum,
@Body() updatePipelineDto,
@Param('id') id,
@Param('id') id: string,
@User() user: RequestUser,
) {
this.logger.info('PipelinesController - put', { user });
@@ -302,9 +301,8 @@ export class PipelinesController {
@Delete(':id')
@ApiNoContentResponse()
@HttpCode(HttpStatus.NO_CONTENT)
async delete(@Param() params, @User() user: RequestUser) {
async delete(@Param('id') id: string, @User() user: RequestUser) {
this.logger.info('PipelinesController - delete', { user });
const { id } = params;
const metadata = PackTheMetadata({
customer_id: user.customer_id,
customer_name: user.customer_name,
@@ -416,8 +414,7 @@ export class PipelinesController {
@ApiInternalOnlyEndpoint()
@Post('start/:id')
async activate(@Param() params, @Body() body) {
const { id } = params;
async activate(@Param('id') id: string, @Body() body) {
const { info } = body;
this.logger.info(
@@ -72,8 +72,7 @@ export class TransformationsController {
@Get('/:id')
@RequireSomePermission(pipelinePermissions.GET)
async findOne(@Body() data, @Param() params) {
const { id } = params;
async findOne(@Body() data, @Param('id') id: string) {
this.logger.info(`/transformation/${id} - ON Find One ROUTE`, {
user: data.info.user_id,
customer: data.info.customer,