Skip to content

Commit

Permalink
Merge pull request #32 from kusitms-28th-Meetup-E/feat/bubble
Browse files Browse the repository at this point in the history
fix : 구독 중복 예외처리
  • Loading branch information
seungueonn authored Nov 23, 2023
2 parents 5be9f6c + c7822d5 commit f3b2e28
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,15 @@ public SubscribeRes subscribe(String socialId,Long topicId, Long issueId) {
Member member = memberQueryService.getMemberBySocialId(socialId);

if (subscribeQueryService.isAbleToSubscribe(member)) {

if (member.getSubscribeList().stream()
.anyMatch(subscribe -> subscribe.getIssueId().equals(issueId))) {

throw new NoAccessSubscribe();

}
Subscribe save = subscribeSaveService.save(subscribeMapper.mapToSubscribe(member, issueId));
member.getSubscribeList().add(save);

// publishSubscribeChange.publishMemberChange();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ public interface SubscribeCustomRepository {




}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public SubscribeMemberDto findAllSubscribeByMember(Member member) {
.fetchOne();
}

public Subscribe findSubscribeByMemberAndTopic(Member member,Long issueId) {
public Subscribe findSubscribeByMemberAndTopic(Member member, Long issueId) {
return queryFactory
.select(subscribe)
.from(subscribe)
Expand Down Expand Up @@ -114,4 +114,9 @@ public List<SubscribeData> getIssueBySubscribers() {

}



}



Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,4 @@ public List<SubscribeData> getIssueBySubscribers() {
}





}

0 comments on commit f3b2e28

Please sign in to comment.