adding get all tags function

This commit is contained in:
rodrigo.zamboni
2022-04-20 14:40:01 -03:00
parent 7f1d8e4b2a
commit 0c51014ec9
3 changed files with 28 additions and 1 deletions
+11
View File
@@ -207,6 +207,17 @@ export class CatalogController {
return res;
}
@Get('tags')
async findAllTags(@Body() body) {
console.log(`/catalog`, 'ON FIND ALL TAGS ROUTE');
const catalogService = new CatalogService();
const res = await catalogService.findAllTags(body);
return res;
}
@Delete('tags/:id')
async deleteTags(@Param() params, @Body() body) {
console.log(`/catalog`, 'ON DELETE TAG ROUTE');
+16
View File
@@ -9,6 +9,9 @@ class CatalogService {
const { data } = await axios.get(
`${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/all/`,
);
console.log(
`${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/all/`,
);
return data;
}
@@ -216,6 +219,19 @@ class CatalogService {
return data;
}
async findAllTags(body) {
const customer =
body.info.customer.toLowerCase() === 'dadosfera'
? ``
: `-${body.info.customer.toLowerCase()}`;
const { data } = await axios.get(
`${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/tags/`,
body,
);
return data;
}
async deleteTags(id, body) {
const customer =
body.info.customer.toLowerCase() === 'dadosfera'
+1 -1
View File
File diff suppressed because one or more lines are too long