Skip to content

Commit

Permalink
[FIX] 게시글이 0개일 때 200 반환 (#363)
Browse files Browse the repository at this point in the history
  • Loading branch information
yubinquitous authored Aug 3, 2024
1 parent 4ff8dd3 commit e9988cb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions functions/api/routes/community/communityCategoryPostsGET.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ module.exports = asyncWrapper(async (req, res) => {
const totalPageCount = Math.ceil(totalItemCount / limit);
const currentPage = +page;

// 게시글이 없는 경우
if (totalItemCount === 0) {
return res
.status(statusCode.OK)
.send(util.success(statusCode.OK, responseMessage.NO_COMMUNITY_POST));
}

// 요청한 페이지가 존재하지 않는 경우
if (page > totalPageCount) {
return res
Expand Down
7 changes: 7 additions & 0 deletions functions/api/routes/community/communityPostsGET.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ module.exports = asyncWrapper(async (req, res) => {
const totalPageCount = Math.ceil(totalItemCount / limit);
const currentPage = +page;

// 게시글이 없는 경우
if (totalItemCount === 0) {
return res
.status(statusCode.OK)
.send(util.success(statusCode.OK, responseMessage.NO_COMMUNITY_POST));
}

// 요청한 페이지가 존재하지 않는 경우
if (page > totalPageCount) {
return res
Expand Down

0 comments on commit e9988cb

Please sign in to comment.