diff --git a/src/routes/bookbox.route.js b/src/routes/bookbox.route.js index e980f10..bb02aed 100644 --- a/src/routes/bookbox.route.js +++ b/src/routes/bookbox.route.js @@ -21,7 +21,7 @@ Router.get('/', async (req, res) => { Router.post('/', Auth, Upload.single('file'), Validation('bookbox'), async (req, res) => { try { - if (!Images.checkFileType(req.file)) { + if (req.file && !Images.checkFileType(req.file)) { res.sendStatus(HttpStatus.BAD_REQUEST); return; } diff --git a/src/routes/users.route.js b/src/routes/users.route.js index 8c3940e..b78cbb0 100644 --- a/src/routes/users.route.js +++ b/src/routes/users.route.js @@ -24,6 +24,8 @@ Router.post('/', Limiter(Config.limits.critical), Validation('users'), async (re return; } + user.refreshToken = await Users.createRefreshToken(user.id, '1 day'); + user.token = Users.createJwt({ id: user.id, role: role.name @@ -40,10 +42,6 @@ Router.post('/', Limiter(Config.limits.critical), Validation('users'), async (re return; } - if (parseInt(e.code) === 23505) { - res.sendStatus(HttpStatus.CONFLICT); - return; - } res.sendStatus(HttpStatus.INTERNAL_SERVER_ERROR); } });