Skip to content

Commit

Permalink
✨ Feat: 회원 탈퇴 시, 해당 유저의 모든 FCM 토큰 지우는 로직 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
HyoBN committed Aug 27, 2024
1 parent 2c12e10 commit c07e65b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import treehouse.server.global.exception.GlobalErrorCode;
import treehouse.server.global.exception.ThrowClass.AuthException;
import treehouse.server.global.exception.ThrowClass.GeneralException;
import treehouse.server.global.fcm.service.FcmService;
import treehouse.server.global.redis.service.RedisService;
import treehouse.server.global.security.jwt.dto.TokenDTO;
import treehouse.server.global.security.provider.TokenProvider;
Expand All @@ -39,6 +40,8 @@ public class UserService {
private final InvitationQueryAdapter invitationQueryAdapter;
private final UserRepository userRepository;

private final FcmService fcmService;

@Transactional(readOnly = true)
public UserResponseDTO.checkName checkName(UserRequestDTO.checkName request){
return UserMapper.toCheckNameDTO(userQueryAdapter.checkName(request));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public CommonResponse<UserResponseDTO.checkUserStatus> checkPhoneAuth(
public CommonResponse<UserResponseDTO.withdraw> withdraw(
@AuthMember @Parameter(hidden = true) User user
){
fcmService.deleteAllFcmToken(user);
return CommonResponse.onSuccess(userService.withdraw(user));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,9 @@ public void sendFcmMessage(User receiver, String title, String body) {


}

@Transactional
public void deleteAllFcmToken(User user) {
fcmTokenRepository.deleteAllByUser(user);
}
}

0 comments on commit c07e65b

Please sign in to comment.