From bd721d52f4aaf820264d3e0d314b1487727106a4 Mon Sep 17 00:00:00 2001 From: hugh-obrien Date: Thu, 23 Aug 2018 14:39:48 +0100 Subject: [PATCH] review fixes and moving licences endpoint to module --- .../app/coffee/Features/Analytics/AnalyticsController.coffee | 3 +-- .../web/app/coffee/Features/Analytics/AnalyticsRouter.coffee | 2 -- .../app/coffee/Features/Institutions/InstitutionsAPI.coffee | 2 +- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/services/web/app/coffee/Features/Analytics/AnalyticsController.coffee b/services/web/app/coffee/Features/Analytics/AnalyticsController.coffee index 7773064481..e407feb488 100644 --- a/services/web/app/coffee/Features/Analytics/AnalyticsController.coffee +++ b/services/web/app/coffee/Features/Analytics/AnalyticsController.coffee @@ -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 diff --git a/services/web/app/coffee/Features/Analytics/AnalyticsRouter.coffee b/services/web/app/coffee/Features/Analytics/AnalyticsRouter.coffee index fb0f890241..57b131326f 100644 --- a/services/web/app/coffee/Features/Analytics/AnalyticsRouter.coffee +++ b/services/web/app/coffee/Features/Analytics/AnalyticsRouter.coffee @@ -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') diff --git a/services/web/app/coffee/Features/Institutions/InstitutionsAPI.coffee b/services/web/app/coffee/Features/Institutions/InstitutionsAPI.coffee index def1426a28..e2fdab68d7 100644 --- a/services/web/app/coffee/Features/Institutions/InstitutionsAPI.coffee +++ b/services/web/app/coffee/Features/Institutions/InstitutionsAPI.coffee @@ -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) ->) ->