clear catalog

This commit is contained in:
Victor Radael
2022-10-11 22:23:36 -03:00
parent 85f41521ed
commit 779418f471
2 changed files with 0 additions and 180 deletions
-89
View File
@@ -338,34 +338,6 @@ export class CatalogController {
return res;
}
@Get('data-description')
async getDataDescription(@Body() body) {
this.logger.info(`/catalog - ON GET DATA DESCRIPTION ROUTE`, {
user: body.info.user_id,
customer: body.info.customer,
});
const res = await this.catalogService.getDataDescription(body);
return res;
}
@Post('data-description')
async createDataDescription(@Body() body, @User() user: RequestUser) {
this.logger.info(`/catalog - ON CREATE DATA DESCRIPTION ROUTE`, {
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,
});
return await this.catalogService.createDataDescription(body, metadata);
}
@Get('data-docs')
async getDataDocs(@Body() body) {
this.logger.info(`/catalog - ON GET DATA DOCS ROUTE`, {
@@ -502,67 +474,6 @@ export class CatalogController {
return res;
}
@Delete('tags/:id')
async deleteTags(@Param() params, @Body() body) {
this.logger.info(`/catalog - ON DELETE TAG ROUTE`, {
user: body.info.user_id,
customer: body.info.customer,
});
const { id } = params;
body.data_asset_id = id;
const { user_id, customer, customer_id } = body.info;
const metadata = PackTheMetadata({
user_id,
customer_id,
customer_name: customer,
});
const res = await this.catalogService.deleteTags(body, metadata);
return res;
}
@Post('table-tags')
async createTableTags(@Body() body) {
this.logger.info(`/catalog - ON CREATE TABLE TAG ROUTE`, {
user: body.info.user_id,
customer: body.info.customer,
});
const res = await this.catalogService.createTableTags(body);
return res;
}
@Get('table-tags/:data_asset_id')
async getAllTableTags(@Body() body, @Param() params) {
this.logger.info(`/catalog - ON GET ALL TABLE TAGS ROUTE`, {
user: body.info.user_id,
customer: body.info.customer,
});
const { user_id, customer, customer_id } = body.info;
const metadata = PackTheMetadata({
user_id,
customer_id,
customer_name: customer,
});
const res = await this.catalogService.findAllTableTags(params, metadata);
return res;
}
@Delete('table-tags/:id')
async deleteTableTags(@Param() params, @Body() body) {
this.logger.info(`/catalog - ON CREATE TABLE TAGS ROUTE`, {
user: body.info.user_id,
customer: body.info.customer,
});
const { id } = params;
const res = await this.catalogService.deleteTableTags(id, body);
return res;
}
@Get('table-rules')
async getTableRules(@Body() body) {
this.logger.info(`/catalog - ON GET TABLE RULES ROUTE`, {
-91
View File
@@ -390,44 +390,6 @@ class CatalogService implements OnModuleInit {
return data;
}
async getDataDescription(body) {
const nimbusUrl = this._getNimbusUrl(body);
const { data } = await axios.get(
`${nimbusUrl}/api/catalog/data-description/`,
);
return data;
}
async createDataDescription(body, metadata) {
const response = await lastValueFrom(
this.catalogWriteService.UpdateDataAsset(
{
id: `dataset-${body.table_id}`,
description: body.description,
tags: undefined,
},
metadata,
),
);
// {
// description: 'descrição nova';
// id: 5;
// table_id: 4;
// }
// const nimbusUrl = this._getNimbusUrl(body);
// const { data } = await axios.post(
// `${nimbusUrl}/api/catalog/data-description/`,
// body,
// );
// {"id":5,"description":"descrição nova","updated_at":"2022-09-28T14:35:15.618750Z","table_id":4}
return {
id: 0,
description: body.description,
updated_at: new Date().toISOString(),
table_id: body.table_id,
};
}
async getDataDocs(body) {
const nimbusUrl = this._getNimbusUrl(body);
const { data } = await axios.get(`${nimbusUrl}/api/catalog/data-docs/`);
@@ -525,59 +487,6 @@ class CatalogService implements OnModuleInit {
return response;
}
async findAllTableTags(data, metadata) {
this.logger.info('CatalogService - findAllTableTags');
const response = await lastValueFrom(
this.catalogReadService.GetTableTags(data, metadata),
)
.then((res) => {
this.logger.info('Done');
return res;
})
.catch((err) => {
this.logger.error(err.message);
throw new Error(err);
});
return response;
}
async deleteTags(data, metadata) {
this.logger.info('CatalogService - deleteTags');
const response = await lastValueFrom(
this.catalogWriteService.UntagTable(data, metadata),
)
.then((res) => {
this.logger.info('Done');
return res;
})
.catch((err) => {
this.logger.error(err.message);
throw new Error(err);
});
return response;
}
async createTableTags(body) {
const nimbusUrl = this._getNimbusUrl(body);
const { data } = await axios.post(
`${nimbusUrl}/api/catalog/table-tags/`,
body,
);
return data;
}
async deleteTableTags(id, body) {
const nimbusUrl = this._getNimbusUrl(body);
const { data } = await axios.delete(
`${nimbusUrl}/api/catalog/table-tags/${id}`,
);
return data;
}
async getTableRules(body) {
const nimbusUrl = this._getNimbusUrl(body);
const { data } = await axios.get(