Skip to content

Commit

Permalink
#9 fix: 유저 차단API-관련 보드의 멤버 삭제메소드 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
xhaktmchl committed Mar 9, 2023
1 parent cfa972c commit e72d446
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ public ApplicationResponse<BlockRes> createBlock(CreateBlockReq dto){
List<BoardUser> 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();
}
}
}
Expand All @@ -82,8 +82,8 @@ public ApplicationResponse<BlockRes> createBlock(CreateBlockReq dto){
List<BoardUser> 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();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -41,4 +42,8 @@ public BoardUser(User user, Board board) {
public void changeApplyStatus(){
this.applyStatus = 1;
}

public void changeStatusToInactive(){
this.setStatus(BaseStatus.INACTIVE);
}
}

0 comments on commit e72d446

Please sign in to comment.