review fixes and moving licences endpoint to module

This commit is contained in:
hugh-obrien 2018-08-23 14:39:48 +01:00
parent 8d72fc78fc
commit bd721d52f4
3 changed files with 2 additions and 5 deletions

View file

@ -25,11 +25,10 @@ module.exports = AnalyticsController =
respondWith(error, res, next)
licences: (req, res, next) ->
AuthenticationController.getLoggedInUserId(req) or req.sessionID
{resource_id, start_date, end_date, lag} = req.query
InstitutionsAPI.getInstitutionLicences resource_id, start_date, end_date, lag, (error, licences) ->
if error?
res.send 503
next(error)
else
res.send licences

View file

@ -9,8 +9,6 @@ module.exports =
webRouter.put '/editingSession/:projectId',
AnalyticsController.updateEditingSession
webRouter.get '/graphs/licences', AnalyticsController.licences
publicApiRouter.use '/analytics/graphs',
AuthenticationController.httpAuth,
AnalyticsProxy.call('/graphs')

View file

@ -16,7 +16,7 @@ module.exports = InstitutionsAPI =
method: 'GET'
path: "/api/v2/institutions/#{institutionId.toString()}/institution_licences"
body: {start_date: startDate, end_date: endDate, lag}
defaultErrorMessage: "Couldn't get institution affiliations"
defaultErrorMessage: "Couldn't get institution licences"
}, callback
getUserAffiliations: (userId, callback = (error, body) ->) ->