diff --git a/src/main/java/com/yello/server/domain/authorization/service/AuthService.java b/src/main/java/com/yello/server/domain/authorization/service/AuthService.java index d995dd79..85a7e813 100644 --- a/src/main/java/com/yello/server/domain/authorization/service/AuthService.java +++ b/src/main/java/com/yello/server/domain/authorization/service/AuthService.java @@ -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); diff --git a/src/main/java/com/yello/server/domain/vote/service/VoteService.java b/src/main/java/com/yello/server/domain/vote/service/VoteService.java index afcdc96a..2ab53406 100644 --- a/src/main/java/com/yello/server/domain/vote/service/VoteService.java +++ b/src/main/java/com/yello/server/domain/vote/service/VoteService.java @@ -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(); diff --git a/src/main/java/com/yello/server/infrastructure/firebase/service/NotificationFcmService.java b/src/main/java/com/yello/server/infrastructure/firebase/service/NotificationFcmService.java index 58aa485c..3bb414e8 100644 --- a/src/main/java/com/yello/server/infrastructure/firebase/service/NotificationFcmService.java +++ b/src/main/java/com/yello/server/infrastructure/firebase/service/NotificationFcmService.java @@ -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 = diff --git a/src/main/java/com/yello/server/infrastructure/firebase/service/NotificationService.java b/src/main/java/com/yello/server/infrastructure/firebase/service/NotificationService.java index e613b4aa..cfc40446 100644 --- a/src/main/java/com/yello/server/infrastructure/firebase/service/NotificationService.java +++ b/src/main/java/com/yello/server/infrastructure/firebase/service/NotificationService.java @@ -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); } diff --git a/src/main/java/com/yello/server/infrastructure/scheduler/EventScheduler.java b/src/main/java/com/yello/server/infrastructure/scheduler/EventScheduler.java index 82f43bc8..0d1b43a3 100644 --- a/src/main/java/com/yello/server/infrastructure/scheduler/EventScheduler.java +++ b/src/main/java/com/yello/server/infrastructure/scheduler/EventScheduler.java @@ -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임, 동일한 값이 세팅되면 두번째부터 실행안됨) diff --git a/src/test/java/com/yello/server/infrastructure/firebase/NotificationFcmServiceTest.java b/src/test/java/com/yello/server/infrastructure/firebase/NotificationFcmServiceTest.java index a650f5b1..d0ba4b2f 100644 --- a/src/test/java/com/yello/server/infrastructure/firebase/NotificationFcmServiceTest.java +++ b/src/test/java/com/yello/server/infrastructure/firebase/NotificationFcmServiceTest.java @@ -141,7 +141,7 @@ void init() { // when // then - notificationService.sendOpenVoteNotification(vote.getSender()); + notificationService.sendOpenVoteNotification(target, user); } @Test @@ -151,7 +151,7 @@ void init() { // when // then - notificationService.sendRecommendSignupAndGetTicketNotification(target); + notificationService.sendRecommendSignupAndGetTicketNotification(target, user); } @Test