Skip to content

Commit

Permalink
Changing /api/log to /api/log-entry because uBlock
Browse files Browse the repository at this point in the history
  • Loading branch information
etousley committed Sep 1, 2017
1 parent 2cdccad commit 2fab56c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion controllers/logEntry.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ exports.renderLog = (req, res) => {
/**
* REST API endpoint
* GET all log entries. Can filter with query string, e.g.:
* /api/[email protected]&from=2017-05-01&to=2017-06-01
* /api/log-entry[email protected]&from=2017-05-01&to=2017-06-01
*/
exports.getLogEntries = (req, res) => {
let user = req.query.user; // user's email address
Expand Down
8 changes: 4 additions & 4 deletions public/js/log.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand All @@ -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) {
Expand All @@ -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();
Expand Down

0 comments on commit 2fab56c

Please sign in to comment.