[develop | DONE | CHANGED]: utils-service: Added request to irish-monitor-service to get Funders (/stakeholder?type=funder) and their dashboard info.

1. beta.properties & production-properties.file & properties.file: Added irishMonitorAPIUrl.
2. uploadService.js: Added request to irishMonitorAPIUrl and in the response added irishAlias and irishVisibility.
This commit is contained in:
Konstantina Galouni 2024-09-05 18:18:38 +03:00
parent 7ca0d9e8b8
commit 5d0c69e410
4 changed files with 32 additions and 4 deletions

View File

@ -1,6 +1,7 @@
userInfoUrl = https://beta.services.openaire.eu/login-service/userInfo
searchServiceAPIUrl = https://beta.services.openaire.eu/search/v2/api/
monitorAPIUrl = https://beta.services.openaire.eu/uoa-monitor-service/
irishMonitorAPIUrl = https://beta.services.openaire.eu/irish-monitor-service/
fundersServiceAPIUrl = https://beta.services.openaire.eu/openaire/funders/
ssl = true
localPath = false

View File

@ -1,6 +1,7 @@
userInfoUrl = https://services.openaire.eu/login-service/userInfo
searchServiceAPIUrl = https://services.openaire.eu/search/v2/api/
monitorAPIUrl = https://services.openaire.eu/uoa-monitor-service/
irishMonitorAPIUrl = https://services.openaire.eu/irish-monitor-service/
fundersServiceAPIUrl = https://services.openaire.eu/openaire/funders/
ssl = true
localPath = false

View File

@ -1,7 +1,8 @@
userInfoUrl = http://mpagasas.di.uoa.gr:19080/login-service/userInfo
searchServiceAPIUrl = https://beta.services.openaire.eu/search/v2/api/
monitorAPIUrl = http://duffy.di.uoa.gr:19380/uoa-monitor-service/
fundersServiceAPIUrl = https://beta.services.openaire.eu/openaire/funders/
irishMonitorAPIUrl = http://mpagasas.di.uoa.gr:19780/irish-monitor-service/
fundersServiceAPIUrl = https://dev-openaire.d4science.org/openaire/funders/
ssl = false
localPath = true
# photo size in KB

View File

@ -15,6 +15,7 @@ if (properties.get('ssl')) {
}
var searchServiceAPIUrl = properties.get('searchServiceAPIUrl');
var monitorServiceAPIUrl = properties.get('monitorAPIUrl');
var irishMonitorServiceAPIUrl = properties.get('irishMonitorAPIUrl');
var fundersServiceAPIUrl = properties.get('fundersServiceAPIUrl');
var auth = properties.get('userInfoUrl');
/** @deprecated*/
@ -224,6 +225,7 @@ app.get('/explore/funders', async function (req, res) {
searchServiceAPIUrl + 'resources2/?format=json&type=results&fq=relfunder=*&refine=true&fields=relfunder&sf=relfunder&page=0&size=0&fq=resultbestaccessright%20exact%20%22Open%20Access%22',
searchServiceAPIUrl + 'resources2/?format=json&type=projects&fq=funder=*&fq=projectcode<>"unidentified"&refine=true&fields=funder&sf=funder&page=0&size=0',
monitorServiceAPIUrl + 'stakeholder?type=funder',
irishMonitorServiceAPIUrl + 'stakeholder?type=funder',
fundersServiceAPIUrl
]
const dataPromises = requests.map((url) => axios.get( url));
@ -267,6 +269,7 @@ app.get('/explore/funders', async function (req, res) {
let ministakeholder = {
id:id, name:stakeholder.name,
alias: stakeholder.alias, visibility: stakeholder.visibility,
irishAlias: '', irishVisibility: '',
logoUrl:stakeholder.logoUrl, isUpload: stakeholder.isUpload, websiteUrl: null}
fundersMap.get(id).stakeholder = ministakeholder;
@ -276,7 +279,25 @@ app.get('/explore/funders', async function (req, res) {
}
});
let funders = dataResponses[4].data;
let irishStakeholders = dataResponses[4].data;
irishStakeholders.forEach(stakeholder => {
let id = stakeholder.index_id + "||" + stakeholder.index_name + "||" + stakeholder.index_shortName;
if (fundersMap.has(id) && (!fundersMap.get(id).stakeholder || (fundersMap.get(id).name === stakeholder.name) || (fundersMap.get(id).shortName === stakeholder.index_shortName))) {
let ministakeholder = {
id:id, name:stakeholder.name,
alias: fundersMap.get(id).stakeholder ? fundersMap.get(id).stakeholder.alias : '',
visibility: fundersMap.get(id).stakeholder ? fundersMap.get(id).stakeholder.visibility : '',
irishAlias: stakeholder.alias, irishVisibility: stakeholder.visibility,
logoUrl:stakeholder.logoUrl, isUpload: stakeholder.isUpload, websiteUrl: null}
fundersMap.get(id).stakeholder = ministakeholder;
if(!fundersMap.get(id).shortName) {
fundersMap.get(id).shortName = stakeholder.index_shortName;
}
}
});
let funders = dataResponses[5].data;
funders.forEach(funder => {
// let id = funder.id + "||" + (funder.legalName ? (funder.legalName + "||" + (funder.legalShortName ? funder.legalShortName : "")) : "");
// if (fundersMap.has(id)) {
@ -306,9 +327,13 @@ app.get('/explore/funders', async function (req, res) {
// }
let ministakeholder = {
id:storedFunder.id, name:storedStakeholder?.name, alias: storedStakeholder?.alias ? storedStakeholder.alias : funder.legalShortName,
id:storedFunder.id, name:storedStakeholder?.name,
alias: storedStakeholder?.alias ? storedStakeholder.alias : funder.legalShortName,
visibility: storedStakeholder?.visibility,
irishAlias: storedStakeholder?.irishAlias ? storedStakeholder.irishAlias : funder.legalShortName,
irishVisibility: storedStakeholder?.irishVisibility,
websiteUrl: funder.websiteUrl, logoUrl: storedStakeholder?.logoUrl ? storedStakeholder.logoUrl : funder.logoUrl,
visibility: storedStakeholder?.visibility, isUpload: storedStakeholder?.isUpload
isUpload: storedStakeholder?.isUpload
};
storedFunder.stakeholder = ministakeholder;
// } else {