-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨: feat 오늘의 질문 daily notification #33
- Loading branch information
Showing
4 changed files
with
35 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...api/src/main/kotlin/com/th/plu/api/controller/notification/ScheduledNotificationSender.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.th.plu.api.controller.notification | ||
|
||
import com.th.plu.api.controller.notification.dto.request.MessageSendRequest | ||
import com.th.plu.api.service.notification.NotificationService | ||
import com.th.plu.common.Slf4JKotlinLogging.log | ||
import org.springframework.scheduling.annotation.Scheduled | ||
import org.springframework.stereotype.Component | ||
|
||
@Component | ||
class ScheduledNotificationSender(private val notificationService: NotificationService) { | ||
@Scheduled(cron = "0 0 22 * * ?") | ||
fun sendDailyNotification() { | ||
notificationService.sendMessageToAllMember(MessageSendRequest.DAILY_QUESTION_MESSAGE()) | ||
log.info { "오늘의 질문 알림을 보냈습니다." } | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
.../src/main/kotlin/com/th/plu/api/controller/notification/dto/request/MessageSendRequest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,10 @@ | ||
package com.th.plu.api.controller.notification.dto.request | ||
|
||
data class MessageSendRequest(var title: String, var body: String) { | ||
companion object { | ||
fun DAILY_QUESTION_MESSAGE() = MessageSendRequest( | ||
title = "오늘의 질문 알림", | ||
body = "오늘의 질문에 답할 시간입니다." | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters