Merge pull request #2079 from overleaf/ta-institution-new-licences

Add Routing for New Licences Metrics Graph

GitOrigin-RevId: 9e7def383d257db1eef03b1224b4b5fef376427c
This commit is contained in:
Eric Mc Sween 2019-08-20 08:42:42 -04:00 committed by sharelatex
parent 4d69b63993
commit 0e8866f651
2 changed files with 30 additions and 0 deletions

View file

@ -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)
}
)
}
}

View file

@ -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) {}