new protospack

This commit is contained in:
Gabriel Rosa
2022-09-28 11:20:17 -03:00
parent e724ef5ccc
commit 4877fab945
6 changed files with 56 additions and 24 deletions
+24 -9
View File
@@ -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);