Skip to content

Commit

Permalink
YEL-214 [setting] YEL-214 [fix] 푸시알림 target, user 설정
Browse files Browse the repository at this point in the history
  • Loading branch information
hyeonjeongs committed Mar 1, 2024
1 parent 82547af commit cc1d650
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public void recommendUser(String recommendYelloId, String userYelloId) {
ZonedDateTime.now(GlobalZoneId).format(ISO_OFFSET_DATE_TIME),
recommendedUser
));
notificationService.sendRecommendSignupAndGetTicketNotification(recommendedUser);
notificationService.sendRecommendSignupAndGetTicketNotification(recommendedUser, user);
}

notificationService.sendRecommendNotification(user, recommendedUser);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public VoteDetailResponse findVoteById(Long voteId, Long userId) {
final User user = userRepository.getById(userId);

if(!vote.getIsRead()) {
notificationService.sendOpenVoteNotification(vote.getSender());
notificationService.sendOpenVoteNotification(vote.getSender(), user);
}

vote.read();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,21 +135,21 @@ public void sendLunchEventNotification(User user) {
}

@Override
public void sendOpenVoteNotification(User sender) {
public void sendOpenVoteNotification(User target, User user) {
NotificationMessage notificationMessage =
NotificationMessage.toUserOpenVoteNotificationContent(sender);
NotificationMessage.toUserOpenVoteNotificationContent(user);

if (sender.getDeviceToken() != null && !Objects.equals(sender.getDeviceToken(), "")) {
if (target.getDeviceToken() != null && !Objects.equals(target.getDeviceToken(), "")) {
final Message message =
fcmManager.createMessage(sender.getDeviceToken(), notificationMessage);
fcmManager.createMessage(target.getDeviceToken(), notificationMessage);
fcmManager.send(message);
}
}

@Override
public void sendRecommendSignupAndGetTicketNotification(User recommendUser) {
public void sendRecommendSignupAndGetTicketNotification(User recommendUser, User user) {
NotificationMessage notificationMessage =
NotificationMessage.toUserAndFriendRecommendSignupAndGetTicketNotificationContent(recommendUser);
NotificationMessage.toUserAndFriendRecommendSignupAndGetTicketNotificationContent(user);

if (recommendUser.getDeviceToken() != null && !Objects.equals(recommendUser.getDeviceToken(), "")) {
final Message message =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public interface NotificationService {
EmptyObject adminSendCustomNotification(Long adminId, NotificationCustomMessage request);
void sendLunchEventNotification(User userList);

void sendOpenVoteNotification(User user);
void sendOpenVoteNotification(User target, User user);

void sendRecommendSignupAndGetTicketNotification(User user);
void sendRecommendSignupAndGetTicketNotification(User recommendUser, User user);
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class EventScheduler {
private final JobRepository jobRepository;
private final PlatformTransactionManager transactionManager;

@Scheduled(cron = "0 0 12 * * ?")
@Scheduled(cron = "0 20 16 * * ?")
public void lunchEventRunJob() {

//JobParamter의 역할은 반복해서 실행되는 Job의 유일한 ID임, 동일한 값이 세팅되면 두번째부터 실행안됨)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ void init() {

// when
// then
notificationService.sendOpenVoteNotification(vote.getSender());
notificationService.sendOpenVoteNotification(target, user);
}

@Test
Expand All @@ -151,7 +151,7 @@ void init() {

// when
// then
notificationService.sendRecommendSignupAndGetTicketNotification(target);
notificationService.sendRecommendSignupAndGetTicketNotification(target, user);
}

@Test
Expand Down

0 comments on commit cc1d650

Please sign in to comment.