Skip to content

feat: 차단 기능 구현#57

Merged
sinsehwan merged 18 commits intomainfrom
feat/46-user-block
Apr 8, 2026
Merged

feat: 차단 기능 구현#57
sinsehwan merged 18 commits intomainfrom
feat/46-user-block

Conversation

@jinwon1234
Copy link
Copy Markdown
Collaborator

변경점 👍

close: #46
유저 차단 기능 구현 완료했습니다.

  1. 유저 차단 기능
  2. 유저 차단 취소 기능
  3. 차단한 유저 조회 기능

차단했거나 차단된 유저는 다음과 같은 정책을 따릅니다.

  1. 차단했거나 차단된 유저의 랜덤 일기가 보이지 않는다.
  2. 차단했거나 차단된 유저는 검색이 되지 않는다. (좋아요한 유저, 단순 유저 검색)

@jinwon1234 jinwon1234 self-assigned this Apr 8, 2026
@jinwon1234 jinwon1234 added the enhancement New feature or request label Apr 8, 2026
Copy link
Copy Markdown
Collaborator

@sinsehwan sinsehwan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다! 궁금한 거 몇 개 남겼어요

.join(diaryLikeEntity.user, userEntity).fetchJoin()
.where(
diaryLikeEntity.diary.id.eq(diaryId),
diaryLikeEntity.user.id.notIn(blockedUserIds),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

빈 set이 넘어갈 때 null로 분기처리하면 더 안전할 것 같습니다

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BooleanExpression으로 따로 빼겠습니다!


Set<Long> blockedUserIds = userBlockLowService.getBlockedUserIds(userId);

blockedUserIds.add(userId); // 랜덤에서는 본인 아이디도 제외
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

응답 set을 변경하기보다 새로 만들어서 조합하는 것이 더 직관적일 것 같습니다!

Set<Long> blockedUserIds = new HashSet<>(userBlockLowService.getBlockedUserIds(userId));
  blockedUserIds.add(userId);

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

넵 수정하겠습니다!

private final UserLowService userLowService;
private final SubscribeLowService subscribeLowService;

public void addBlockedUser(Long blockedUserId, Long blockerId) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

만약 blockedUserId랑 blockerId가 같으면 어떻게 되나요?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오... BadRequest로 막도록하겠습니다!

@sinsehwan sinsehwan merged commit ad4a83c into main Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

유저 차단

2 participants