Skip to content

Commit

Permalink
[FIX] 리뷰 반영
Browse files Browse the repository at this point in the history
  • Loading branch information
unanchoi committed Jul 12, 2023
1 parent 3ffa5b8 commit 2d90fa3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,15 @@ public class ScheduleController {
private final MessageService messageService;
private final DiaryService diaryService;

@Value("${fcm.smeem_title}")
private String MESSAGE_TITLE;
@Value("${fcm.smeem_body}")
private String MESSAGE_BODY;

@Scheduled(cron = "0 0/30 * * * *")
public void pushMessage() throws InterruptedException {
Thread.sleep(1000);
messageService.pushMessageForTrainingTime(LocalDateTime.now());
messageService.pushMessageForTrainingTime(LocalDateTime.now(), MESSAGE_TITLE, MESSAGE_BODY);
}

@Scheduled(cron = "0 0 0 * * *")
Expand Down
7 changes: 2 additions & 5 deletions src/main/java/com/smeme/server/service/MessageService.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,9 @@ public class MessageService {
@Value("${fcm.google_api}")
private String GOOGLE_API_URI;

private static final String MESSAGE_TITLE = "오늘의 영어 훈련, 딱 5분 걸려요!";
private static final String MESSAGE_BODY = "지금 눌러서 일기 쓰기 ✍️";

public void pushMessageForTrainingTime(LocalDateTime now) {
public void pushMessageForTrainingTime(LocalDateTime now, String title, String body) {
trainingTimeRepository.getTrainingTimeForPushAlarm(now)
.forEach(trainingTime -> pushMessage(trainingTime.getMember().getFcmToken(), MESSAGE_TITLE, MESSAGE_BODY));
.forEach(trainingTime -> pushMessage(trainingTime.getMember().getFcmToken(), title, body));
}

public void pushTest(String title, String body, Long memberId) {
Expand Down

0 comments on commit 2d90fa3

Please sign in to comment.