[develop | DONE | ADDED ] utils service: add calculation date for grouped requests (useful when the response is cached)

This commit is contained in:
argirok 2024-09-19 13:51:22 +03:00
parent 974c43b00d
commit 4ca47d7f36
1 changed files with 8 additions and 4 deletions

View File

@ -131,7 +131,8 @@ app.get('/explore/home', async function (req, res) {
funders: parseNoOfFunders(dataResponses[1].data, dataResponses[4].data),
datasetsInterlinked:dataResponses[5].data.meta.total,
softwareInterlinked:dataResponses[6].data.meta.total,
success:allRequestsSuccessful
success:allRequestsSuccessful,
calculated_at: (new Date()).toUTCString()
};
// Send the aggregated data as the response
@ -162,7 +163,8 @@ app.get('/explore/search', async function (req, res) {
datasources: dataResponses[1].data.total,
organizations: dataResponses[2].data.meta.total,
projects:dataResponses[3].data.total,
success:allRequestsSuccessful
success:allRequestsSuccessful,
calculated_at: (new Date()).toUTCString()
};
@ -204,7 +206,8 @@ app.get('/portals/countResults', async function (req, res) {
datasets: dataResponses[1].data.total,
software: dataResponses[2].data.total,
other:dataResponses[3].data.total,
success:allRequestsSuccessful
success:allRequestsSuccessful,
calculated_at: (new Date()).toUTCString()
};
@ -357,7 +360,8 @@ app.get('/explore/funders', async function (req, res) {
results: dataResponses[0].data.meta.total,
projects: dataResponses[2].data.meta.total,
funders: Array.from(fundersMap.values()),
success:allRequestsSuccessful
success:allRequestsSuccessful,
calculated_at: (new Date()).toUTCString()
};
res.status(allRequestsSuccessful?200:207).json(aggregatedData);