Add documentation and correct typo
This commit is contained in:
@@ -5,6 +5,6 @@ module.exports = {
|
||||
}
|
||||
|
||||
function getDailyAverages(id) {
|
||||
return db('sessions')
|
||||
return db('dailyAverages')
|
||||
.where({ id });
|
||||
}
|
||||
@@ -27,7 +27,7 @@ router.put('/sessions/:id', async (req, res) => {
|
||||
if (session) {
|
||||
res.status(200).json(session);
|
||||
} else {
|
||||
res.status(404).json({ message: 'The session could not be found' });
|
||||
res.status(404).json({ message: 'The session could not be found.' });
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
@@ -37,7 +37,7 @@ router.put('/sessions/:id', async (req, res) => {
|
||||
|
||||
router.delete("/sessions/:id", async (req, res) => {
|
||||
Sessions.removeSession(req.params.id)
|
||||
.then(() => res.status(200).json({ message: 'The session has been successfully deleted' }))
|
||||
.then(() => res.status(200).json({ message: 'The session has been successfully deleted.' }))
|
||||
.catch(err => res.json(err));
|
||||
});
|
||||
|
||||
|
||||
@@ -19,12 +19,12 @@ router.put('/:id', async (req, res) => {
|
||||
res.status(404).json({ message: 'The user could not be found' });
|
||||
}
|
||||
})
|
||||
.catch(err => res.status(500).json({ message: 'Error updating the user' }));
|
||||
.catch(() => res.status(500).json({ message: 'Error updating the user' }));
|
||||
});
|
||||
|
||||
router.delete("/:id", (req, res) => {
|
||||
Users.removeUser(req.params.id)
|
||||
.then(data => res.status(200).json(data))
|
||||
.then(() => res.status(200).json({ message: 'The user was successfully deleted.'}))
|
||||
.catch(err => res.json(err));
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user