Skip to content

Commit

Permalink
Merge branch 'feature/442292_parse_catalog_response' into 'develop'
Browse files Browse the repository at this point in the history
feature/442292_parse_catalog_response

See merge request upm-inesdata/inesdata-public-portal-backend!8
  • Loading branch information
ralconada-gmv committed Sep 12, 2024
2 parents 44b7a8c + ee8e48c commit 2a388d6
Showing 1 changed file with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module.exports = {
delete body.sortOrder
delete body.sortField

const countResponse = await axios.post(countCatalogUrl, body,{
const countResponse = await axios.post(countCatalogUrl, body, {
headers: {
Authorization: `Bearer ${accessToken}`
}
Expand All @@ -39,6 +39,24 @@ module.exports = {
}
});

catalogsResponse.data.forEach(catalog => {
delete catalog['http://www.w3.org/ns/dcat#service'];
delete catalog['originator'];

const datasets = catalog['http://www.w3.org/ns/dcat#dataset'];
if (Array.isArray(datasets)) {
datasets.forEach(dataset => {
delete dataset['http://www.w3.org/ns/dcat#distribution'];
delete dataset['odrl:hasPolicy'];
delete dataset['@type'];
});
} else {
delete datasets['http://www.w3.org/ns/dcat#distribution'];
delete datasets['odrl:hasPolicy'];
delete datasets['@type'];
}
});

const finalResponse = {
catalogs: catalogsResponse.data,
totalElements: countResponse.data
Expand Down

0 comments on commit 2a388d6

Please sign in to comment.