From 2116a0c73ec6068ce290b537783e32232187eeb2 Mon Sep 17 00:00:00 2001 From: youngkwon02 Date: Thu, 17 Feb 2022 15:49:07 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20roomListGET=20error=20case=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- functions/api/routes/room/roomListGET.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/functions/api/routes/room/roomListGET.js b/functions/api/routes/room/roomListGET.js index b8a26d3..e8d6724 100644 --- a/functions/api/routes/room/roomListGET.js +++ b/functions/api/routes/room/roomListGET.js @@ -16,15 +16,19 @@ const roomPOST = require('./roomPOST'); * @습관방_리스트_조회 * @route GET /room?lastId=&size= * @error - * 1. 잘못된 lastId + * 1. lastId 또는 size 값이 전달되지 않음 + * 2. 잘못된 lastId */ module.exports = async (req, res) => { const lastId = Number(req.query.lastId); const size = Number(req.query.size); - console.log(lastId, size); const user = req.user; - console.log(user.userId); + + // @error 1. lastId 또는 size 값이 전달되지 않음 + if (!lastId || !size) { + return res.status(statusCode.BAD_REQUEST).send(util.fail(statusCode.BAD_REQUEST, responseMessage.NULL_VALUE)); + } let client; @@ -49,7 +53,7 @@ module.exports = async (req, res) => { // 최초 요청이 아닐시 if (lastId !== -1) { const lastIndex = _.indexOf(roomIds, lastId); - // @error 1. 잘못된 last Id + // @error 2. 잘못된 last Id if (lastIndex === -1) { return res.status(statusCode.BAD_REQUEST).send(util.fail(statusCode.BAD_REQUEST, responseMessage.INVALID_LASTID)); }