Skip to content

Commit

Permalink
feat: implement allow and deny expiration notifications method
Browse files Browse the repository at this point in the history
  • Loading branch information
inh2613 committed Oct 25, 2023
1 parent cd84433 commit 56f91da
Showing 1 changed file with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,16 +191,27 @@ public UserInfoResponseDto readInfo(String username) {
.username(username)
.nickname(user.getNickname())
.oauth(oAuthService.list(user))
.allowNotifications(isExistDeviceToken(user))
.allowNotifications(user.isAllowNotifications())
.anonymous(user.isAnonymous())
.build();
return userInfoResponseDto;
}

/**
* DeviceToken 조회 메서드 (user)
* 알림 동의 여부 허용 메서드 (user)
*/
public boolean isExistDeviceToken(User user) {
return !deviceTokenRepository.findAllByUser(user).isEmpty();
public void allowNotifications(String username) {
User user = read(username);
user.setAllowNotifications(true);
userRepository.save(user);
}

/**
* 알림 동의 여부 거부 메서드 (user)
*/
public void denyNotifications(String username) {
User user = read(username);
user.setAllowNotifications(false);
userRepository.save(user);
}
}

0 comments on commit 56f91da

Please sign in to comment.