diff --git a/services/web/app/src/Features/Analytics/AnalyticsController.js b/services/web/app/src/Features/Analytics/AnalyticsController.js index c471ea79b6..a852c77d09 100644 --- a/services/web/app/src/Features/Analytics/AnalyticsController.js +++ b/services/web/app/src/Features/Analytics/AnalyticsController.js @@ -48,6 +48,21 @@ module.exports = { res.send(licences) } ) + }, + + newLicences(req, res, next) { + InstitutionsAPI.getInstitutionNewLicences( + req.query.resource_id, + req.query.start_date, + req.query.end_date, + req.query.lag, + function(error, licences) { + if (error) { + return next(error) + } + res.send(licences) + } + ) } } diff --git a/services/web/app/src/Features/Institutions/InstitutionsAPI.js b/services/web/app/src/Features/Institutions/InstitutionsAPI.js index c16c966547..c80962bd31 100644 --- a/services/web/app/src/Features/Institutions/InstitutionsAPI.js +++ b/services/web/app/src/Features/Institutions/InstitutionsAPI.js @@ -48,6 +48,21 @@ module.exports = InstitutionsAPI = { ) }, + getInstitutionNewLicences(institutionId, startDate, endDate, lag, callback) { + if (callback == null) { + callback = function(error, body) {} + } + return makeAffiliationRequest( + { + method: 'GET', + path: `/api/v2/institutions/${institutionId.toString()}/new_institution_licences`, + body: { start_date: startDate, end_date: endDate, lag }, + defaultErrorMessage: "Couldn't get institution new licences" + }, + callback + ) + }, + getUserAffiliations(userId, callback) { if (callback == null) { callback = function(error, body) {}