From 2fab56cf7185f1166c36216bb95bc9cb2d381dd9 Mon Sep 17 00:00:00 2001 From: "elias.tousley" Date: Fri, 1 Sep 2017 12:05:30 -0400 Subject: [PATCH] Changing /api/log to /api/log-entry because uBlock --- app.js | 10 +++++----- controllers/logEntry.js | 2 +- public/js/log.js | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app.js b/app.js index 0e818ad..4cdef1d 100644 --- a/app.js +++ b/app.js @@ -136,19 +136,19 @@ app.get('/contest', passportConfig.isAuthenticated, contestController.renderCont * REST API routes */ // Get all log entries. Can filter with query string, see controller method -app.get('/api/log', passportConfig.isAuthenticated, logEntryController.getLogEntries); +app.get('/api/log-entry', passportConfig.isAuthenticated, logEntryController.getLogEntries); // Get log entry by id -app.get('/api/log/:id', passportConfig.isAuthenticated, logEntryController.getLogEntry); +app.get('/api/log-entry/:id', passportConfig.isAuthenticated, logEntryController.getLogEntry); // Update a single log entry -app.put('/api/log/:id', passportConfig.isAuthenticated, logEntryController.updateLogEntry); +app.put('/api/log-entry/:id', passportConfig.isAuthenticated, logEntryController.updateLogEntry); // Create a new log entry -app.post('/api/log', passportConfig.isAuthenticated, logEntryController.createLogEntry); +app.post('/api/log-entry', passportConfig.isAuthenticated, logEntryController.createLogEntry); // Delete a single log entry -app.delete('/api/log/:id', passportConfig.isAuthenticated, logEntryController.deleteLogEntry); +app.delete('/api/log-entry/:id', passportConfig.isAuthenticated, logEntryController.deleteLogEntry); // Get all activity definitions app.get('/api/activity', passportConfig.isAuthenticated, logEntryController.getActivityDefinitions); diff --git a/controllers/logEntry.js b/controllers/logEntry.js index 55e6a2c..ec880d5 100644 --- a/controllers/logEntry.js +++ b/controllers/logEntry.js @@ -50,7 +50,7 @@ exports.renderLog = (req, res) => { /** * REST API endpoint * GET all log entries. Can filter with query string, e.g.: - * /api/log?user=user@domain.com&from=2017-05-01&to=2017-06-01 + * /api/log-entry?user=user@domain.com&from=2017-05-01&to=2017-06-01 */ exports.getLogEntries = (req, res) => { let user = req.query.user; // user's email address diff --git a/public/js/log.js b/public/js/log.js index a7c8ca2..505050f 100644 --- a/public/js/log.js +++ b/public/js/log.js @@ -45,7 +45,7 @@ fillLogEntries = () => { const dayElems = $('.fc-day') const startDate = dayElems[0].dataset.date; const endDate = dayElems[dayElems.length - 1].dataset.date; - const getLogEntriesUrl = '/api/log?' + jQuery.param({ + const getLogEntriesUrl = '/api/log-entry?' + jQuery.param({ "user": ownerEmail, "from": startDate, "to": endDate @@ -127,7 +127,7 @@ drawLogEntryModal = (clickedDayElem) => { if (activeEntryElem.dataset._id !== undefined) { // If there's already an _id, do a PUT (update) $.ajax({ - url: '/api/log/' + activeEntryElem.dataset._id, + url: '/api/log-entry/' + activeEntryElem.dataset._id, type: 'PUT', data: {"data": entryData}, success: function(data) { @@ -150,7 +150,7 @@ drawLogEntryModal = (clickedDayElem) => { } else { // If there's no _id, do a POST (create) $.ajax({ - url: '/api/log/', + url: '/api/log-entry/', type: 'POST', data: {"data": entryData}, success: function(data) { @@ -176,7 +176,7 @@ drawLogEntryModal = (clickedDayElem) => { */ deleteLogEntry = () => { $.ajax({ - url: '/api/log/' + activeEntryElem.dataset._id, + url: '/api/log-entry/' + activeEntryElem.dataset._id, type: 'DELETE', success: function(data) { activeEntryElem.remove();