mirror of
https://github.com/dadosfera/maestro.git
synced 2026-11-04 05:29:09 +00:00
new protospack
This commit is contained in:
Generated
+7
-7
@@ -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.18.2",
|
||||
"@dadosfera/protospack-v2": "3.18.4",
|
||||
"@grpc/grpc-js": "^1.6.7",
|
||||
"@grpc/proto-loader": "^0.6.13",
|
||||
"@nestjs/common": "^8.4.7",
|
||||
@@ -1726,9 +1726,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@dadosfera/protospack-v2": {
|
||||
"version": "3.18.2",
|
||||
"resolved": "https://dadosfera-611330257153.d.codeartifact.us-east-1.amazonaws.com:443/npm/dadosfera-npm/@dadosfera/protospack-v2/-/protospack-v2-3.18.2.tgz",
|
||||
"integrity": "sha512-p5x7Ory244sOX1q0uJbkgU6eCBfeVWhXn94swMxUikLtsLWuMS/fVM7KGymWbly3pUsanifGyeaiC7XzbPo1LA==",
|
||||
"version": "3.18.4",
|
||||
"resolved": "https://dadosfera-611330257153.d.codeartifact.us-east-1.amazonaws.com:443/npm/dadosfera-npm/@dadosfera/protospack-v2/-/protospack-v2-3.18.4.tgz",
|
||||
"integrity": "sha512-OqnYuwY8gV9/GFtJt4ftv2CQBOuNKpTAimCMPZVMB95CF95npD1Fj+Au5mTctt/hTOkF9gNsd8mcS67SeLn3jg==",
|
||||
"dependencies": {
|
||||
"@grpc/grpc-js": "^1.6.7",
|
||||
"rxjs": "^7.5.5",
|
||||
@@ -12306,9 +12306,9 @@
|
||||
}
|
||||
},
|
||||
"@dadosfera/protospack-v2": {
|
||||
"version": "3.18.2",
|
||||
"resolved": "https://dadosfera-611330257153.d.codeartifact.us-east-1.amazonaws.com:443/npm/dadosfera-npm/@dadosfera/protospack-v2/-/protospack-v2-3.18.2.tgz",
|
||||
"integrity": "sha512-p5x7Ory244sOX1q0uJbkgU6eCBfeVWhXn94swMxUikLtsLWuMS/fVM7KGymWbly3pUsanifGyeaiC7XzbPo1LA==",
|
||||
"version": "3.18.4",
|
||||
"resolved": "https://dadosfera-611330257153.d.codeartifact.us-east-1.amazonaws.com:443/npm/dadosfera-npm/@dadosfera/protospack-v2/-/protospack-v2-3.18.4.tgz",
|
||||
"integrity": "sha512-OqnYuwY8gV9/GFtJt4ftv2CQBOuNKpTAimCMPZVMB95CF95npD1Fj+Au5mTctt/hTOkF9gNsd8mcS67SeLn3jg==",
|
||||
"requires": {
|
||||
"@grpc/grpc-js": "^1.6.7",
|
||||
"rxjs": "^7.5.5",
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@
|
||||
"dependencies": {
|
||||
"@aws-sdk/client-secrets-manager": "^3.112.0",
|
||||
"@dadosfera/dadosfera-logs": "^1.0.0-beta.4",
|
||||
"@dadosfera/protospack-v2": "3.18.2",
|
||||
"@dadosfera/protospack-v2": "3.18.4",
|
||||
"@grpc/grpc-js": "^1.6.7",
|
||||
"@grpc/proto-loader": "^0.6.13",
|
||||
"@nestjs/common": "^8.4.7",
|
||||
|
||||
@@ -14,6 +14,7 @@ import { PERMISSIONS_GROUPS } from '../../authentication/permissions.enum';
|
||||
import { CatalogService } from './catalog.service';
|
||||
import { DadosferaLogger } from '@dadosfera/dadosfera-logs';
|
||||
import { PackTheMetadata } from 'src/utils/ PackTheMetadata';
|
||||
import { RequestUser, User } from 'src/authentication/user.decorator';
|
||||
|
||||
@ApiTags('Catalog')
|
||||
@Controller('catalog')
|
||||
@@ -120,17 +121,31 @@ export class CatalogController {
|
||||
}
|
||||
|
||||
@Get('table-metadata')
|
||||
async getAllTableMetadata(@Body() body, @Query() query) {
|
||||
async getAllTableMetadata(
|
||||
@Body() body,
|
||||
@Query() query,
|
||||
@User() user: RequestUser,
|
||||
) {
|
||||
this.logger.info(`/catalog - ON GET ALL TABLES METADATA ROUTE`, {
|
||||
user: body.info.user_id,
|
||||
customer: body.info.customer,
|
||||
user: user.user_id,
|
||||
customer: user.customer_name,
|
||||
});
|
||||
const { user_id, customer_name, customer_id } = user;
|
||||
const metadata = PackTheMetadata({
|
||||
user_id,
|
||||
customer_id,
|
||||
customer_name,
|
||||
});
|
||||
|
||||
if (!query) {
|
||||
const res = await this.catalogService.getAllTableMetadata(body);
|
||||
return res;
|
||||
} else {
|
||||
const res = await this.catalogService.getOneTableMetadata(body, query);
|
||||
const res = await this.catalogService.getOneTableMetadata(
|
||||
body,
|
||||
query,
|
||||
metadata,
|
||||
);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
@@ -333,16 +348,16 @@ export class CatalogController {
|
||||
}
|
||||
|
||||
@Post('tags')
|
||||
async createTags(@Body() body) {
|
||||
async createTags(@Body() body, @User() user: RequestUser) {
|
||||
this.logger.info(`/catalog - ON CREATE TAG ROUTE`, {
|
||||
user: body.info.user_id,
|
||||
customer: body.info.customer,
|
||||
user: user.user_id,
|
||||
customer: user.customer_name,
|
||||
});
|
||||
const { user_id, customer, customer_id } = body.info;
|
||||
const { user_id, customer_name, customer_id } = user;
|
||||
const metadata = PackTheMetadata({
|
||||
user_id,
|
||||
customer_id,
|
||||
customer_name: customer,
|
||||
customer_name,
|
||||
});
|
||||
|
||||
const res = await this.catalogService.createTags(body, metadata);
|
||||
|
||||
@@ -4,10 +4,10 @@ import { DadosferaLogger } from '@dadosfera/dadosfera-logs';
|
||||
|
||||
import { CatalogController } from './catalog.controller';
|
||||
import { CatalogService } from './catalog.service';
|
||||
import { PipelinesService } from '../pipelinesV2/pipelines.service';
|
||||
import { CatalogClientConfiguration } from './catalog-client';
|
||||
import { ClientsModule } from '@nestjs/microservices';
|
||||
import { PipelinesModule as OldPipelineModule } from 'src/modules/pipelines/pipelines.module';
|
||||
import { UsersModule } from '../users/users.module';
|
||||
|
||||
const client = new CatalogClientConfiguration();
|
||||
|
||||
@@ -15,6 +15,7 @@ const client = new CatalogClientConfiguration();
|
||||
imports: [
|
||||
ClientsModule.register([client.providerOptions]),
|
||||
OldPipelineModule,
|
||||
UsersModule,
|
||||
],
|
||||
controllers: [CatalogController],
|
||||
providers: [CatalogService, DadosferaLogger],
|
||||
|
||||
@@ -40,7 +40,10 @@ class CatalogService implements OnModuleInit {
|
||||
return `https://nimbus-${customer}.dadosfera.ai`;
|
||||
}
|
||||
|
||||
return `https://nimbus-${customer}.${process.env.ENV}.dadosfera.ai`;
|
||||
return `https://nimbus-${customer}.${process.env.ENV.replace(
|
||||
'local',
|
||||
'stg',
|
||||
)}.dadosfera.ai`;
|
||||
}
|
||||
|
||||
async catalogAll(body) {
|
||||
@@ -115,13 +118,26 @@ class CatalogService implements OnModuleInit {
|
||||
return data;
|
||||
}
|
||||
|
||||
async getOneTableMetadata(body, params) {
|
||||
async getOneTableMetadata(body, params, metadata) {
|
||||
const nimbusUrl = this._getNimbusUrl(body);
|
||||
const { data } = await axios.get(
|
||||
`${nimbusUrl}/api/catalog/table-metadata/`,
|
||||
{ params: params },
|
||||
);
|
||||
return data;
|
||||
const { data_asset } = await lastValueFrom(
|
||||
this.catalogReadService.GetOneDataAsset(
|
||||
{ id: data[0].id, type: 'dataset' },
|
||||
metadata,
|
||||
),
|
||||
);
|
||||
const opensearchTable = JSON.parse(data_asset);
|
||||
return [
|
||||
{
|
||||
...data[0],
|
||||
tags: opensearchTable.tags,
|
||||
table_description: opensearchTable.description,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
async deleteOneTableMetadata(id, body) {
|
||||
@@ -272,7 +288,7 @@ class CatalogService implements OnModuleInit {
|
||||
this.logger.info('CatalogService - findAllCustomerTags');
|
||||
|
||||
const response = await lastValueFrom(
|
||||
this.catalogWriteService.GetCustomerTags(data, metadata),
|
||||
this.catalogReadService.GetCustomerTags(data, metadata),
|
||||
)
|
||||
.then((res) => {
|
||||
this.logger.info('Done');
|
||||
@@ -290,7 +306,7 @@ class CatalogService implements OnModuleInit {
|
||||
this.logger.info('CatalogService - findAllTableTags');
|
||||
|
||||
const response = await lastValueFrom(
|
||||
this.catalogWriteService.GetTableTags(data, metadata),
|
||||
this.catalogReadService.GetTableTags(data, metadata),
|
||||
)
|
||||
.then((res) => {
|
||||
this.logger.info('Done');
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user