Skip to content

Commit

Permalink
Merge pull request #226 from IoTeaTime/feature/222-group-fcm-topic
Browse files Browse the repository at this point in the history
fix: 토픽 재구독 예외 처리 추가
  • Loading branch information
ywonchae1 authored Nov 30, 2024
2 parents 5d005bd + 9ea7381 commit cae7f49
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import org.ioteatime.meonghanyangserver.member.repository.MemberRepository;
import org.springframework.stereotype.Service;

import java.util.Optional;

@Service
@RequiredArgsConstructor
public class FcmService {
Expand All @@ -26,11 +28,8 @@ public void saveToken(Long memberId, String token) {
.updateFcmTokenById(memberId, token)
.orElseThrow(() -> new NotFoundException(AuthErrorType.NOT_FOUND));
// 토픽이 갱신될 때마다 토픽 다시 구독
GroupEntity group =
groupMemberRepository
.findGroupFromGroupMember(memberId)
.orElseThrow(() -> new NotFoundException(GroupErrorType.NOT_FOUND));
fcmClient.subTopic(token, group.getFcmTopic());
groupMemberRepository.findGroupFromGroupMember(memberId)
.ifPresent(groupEntity -> fcmClient.subTopic(token, groupEntity.getFcmTopic()));
}

public FcmTopicResponse findFcmTopicByGroupId(Long memberId) {
Expand Down

0 comments on commit cae7f49

Please sign in to comment.