diff options
Diffstat (limited to 'controllers')
| -rw-r--r-- | controllers/albumsController.js | 10 | ||||
| -rw-r--r-- | controllers/authController.js | 6 | ||||
| -rw-r--r-- | controllers/utilsController.js | 2 |
3 files changed, 9 insertions, 9 deletions
diff --git a/controllers/albumsController.js b/controllers/albumsController.js index ed57cac..a395f9b 100644 --- a/controllers/albumsController.js +++ b/controllers/albumsController.js @@ -23,8 +23,8 @@ albumsController.list = async (req, res, next) => { let ids = []; for (let album of albums) { - album.date = new Date(album.timestamp * 1000) - album.date = utils.getPrettyDate(album.date) + album.date = new Date(album.timestamp * 1000); + album.date = utils.getPrettyDate(album.date); album.identifier = `${config.domain}/a/${album.identifier}`; ids.push(album.id); @@ -55,7 +55,7 @@ albumsController.create = async (req, res, next) => { }).first(); if (album) { - return res.json({ success: false, description: 'There\'s already an album with that name' }) + return res.json({ success: false, description: 'There\'s already an album with that name' }); } await db.table('albums').insert({ @@ -96,10 +96,10 @@ albumsController.rename = async (req, res, next) => { const album = await db.table('albums').where({ name: name, userid: user.id }).first(); if (album) { - return res.json({ success: false, description: 'Name already in use' }) + return res.json({ success: false, description: 'Name already in use' }); } - await db.table('albums').where({ id: id, userid: user.id }).update({ name: name }) + await db.table('albums').where({ id: id, userid: user.id }).update({ name: name }); return res.json({ success: true }); }; diff --git a/controllers/authController.js b/controllers/authController.js index ea32275..eb7df09 100644 --- a/controllers/authController.js +++ b/controllers/authController.js @@ -42,10 +42,10 @@ authController.register = async (req, res, next) => { if (password === undefined) return res.json({ success: false, description: 'No password provided' }); if (username.length < 4 || username.length > 32) { - return res.json({ success: false, description: 'Username must have 4-32 characters' }) + return res.json({ success: false, description: 'Username must have 4-32 characters' }); } if (password.length < 6 || password.length > 64) { - return res.json({ success: false, description: 'Password must have 6-64 characters' }) + return res.json({ success: false, description: 'Password must have 6-64 characters' }); } const user = await db.table('users').where('username', username).first(); @@ -63,7 +63,7 @@ authController.register = async (req, res, next) => { token: token, enabled: 1 }); - return res.json({ success: true, token: token }) + return res.json({ success: true, token: token }); }); }; diff --git a/controllers/utilsController.js b/controllers/utilsController.js index ebfb36d..bc182b7 100644 --- a/controllers/utilsController.js +++ b/controllers/utilsController.js @@ -19,7 +19,7 @@ utilsController.getPrettyDate = function(date) { + date.getMinutes() + ':' + (date.getSeconds() < 10 ? '0' : '') + date.getSeconds(); -} +}; utilsController.authorize = async (req, res) => { const token = req.headers.token; |