From e72d4466e6c235e22f10d4854542e1912b8201b6 Mon Sep 17 00:00:00 2001 From: xhaktmchl Date: Thu, 9 Mar 2023 17:58:52 +0900 Subject: [PATCH] =?UTF-8?q?#9=20fix:=20=EC=9C=A0=EC=A0=80=20=EC=B0=A8?= =?UTF-8?q?=EB=8B=A8API-=EA=B4=80=EB=A0=A8=20=EB=B3=B4=EB=93=9C=EC=9D=98?= =?UTF-8?q?=20=EB=A9=A4=EB=B2=84=20=EC=82=AD=EC=A0=9C=EB=A9=94=EC=86=8C?= =?UTF-8?q?=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/yogit/server/block/service/BlockServiceImpl.java | 8 ++++---- .../java/com/yogit/server/board/entity/BoardUser.java | 5 +++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/server/src/main/java/com/yogit/server/block/service/BlockServiceImpl.java b/server/src/main/java/com/yogit/server/block/service/BlockServiceImpl.java index 3b3382f..63c1b44 100644 --- a/server/src/main/java/com/yogit/server/block/service/BlockServiceImpl.java +++ b/server/src/main/java/com/yogit/server/block/service/BlockServiceImpl.java @@ -65,8 +65,8 @@ public ApplicationResponse createBlock(CreateBlockReq dto){ List boardUsers = b.getBoardUsers(); if(!boardUsers.isEmpty()){ for(BoardUser bu: boardUsers){ - if(bu.getUser().getId() == blockingUser.getId() && bu.getStatus().equals(BaseStatus.ACTIVE)){ - boardUserRepository.deleteById(bu.getId()); + if(bu.getUser().getId().equals(blockingUser.getId()) && bu.getStatus().equals(BaseStatus.ACTIVE)){ + bu.changeStatusToInactive(); } } } @@ -82,8 +82,8 @@ public ApplicationResponse createBlock(CreateBlockReq dto){ List boardUsers = b.getBoardUsers(); if(!boardUsers.isEmpty()){ for(BoardUser bu: boardUsers){ - if(bu.getUser().getId() == blockedUser.getId() && bu.getStatus().equals(BaseStatus.ACTIVE)){ - boardUserRepository.deleteById(bu.getId()); + if(bu.getUser().getId().equals(blockedUser.getId()) && bu.getStatus().equals(BaseStatus.ACTIVE)){ + bu.changeStatusToInactive(); } } } diff --git a/server/src/main/java/com/yogit/server/board/entity/BoardUser.java b/server/src/main/java/com/yogit/server/board/entity/BoardUser.java index 08f7237..2374da9 100644 --- a/server/src/main/java/com/yogit/server/board/entity/BoardUser.java +++ b/server/src/main/java/com/yogit/server/board/entity/BoardUser.java @@ -1,6 +1,7 @@ package com.yogit.server.board.entity; import com.yogit.server.config.domain.BaseEntity; +import com.yogit.server.config.domain.BaseStatus; import com.yogit.server.user.entity.User; import lombok.AccessLevel; import lombok.Getter; @@ -41,4 +42,8 @@ public BoardUser(User user, Board board) { public void changeApplyStatus(){ this.applyStatus = 1; } + + public void changeStatusToInactive(){ + this.setStatus(BaseStatus.INACTIVE); + } }