init
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
package space.luminic.finance.utils
|
||||
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.springframework.scheduling.annotation.Scheduled
|
||||
import org.springframework.stereotype.Component
|
||||
import space.luminic.finance.models.PushMessage
|
||||
import space.luminic.finance.services.SubscriptionService
|
||||
import space.luminic.finance.services.TokenService
|
||||
|
||||
|
||||
@Component
|
||||
class ScheduledTasks(private val subscriptionService: SubscriptionService,
|
||||
private val tokenService: TokenService) {
|
||||
private val logger = LoggerFactory.getLogger(ScheduledTasks::class.java)
|
||||
|
||||
@Scheduled(cron = "0 30 19 * * *")
|
||||
suspend fun sendNotificationOfMoneyFilling() {
|
||||
subscriptionService.sendToAll(
|
||||
PushMessage(
|
||||
title = "Время заполнять траты!🤑",
|
||||
body = "Проверь все ли траты внесены!",
|
||||
icon = "/apple-touch-icon.png",
|
||||
badge = "/apple-touch-icon.png",
|
||||
url = "https://luminic.space/transactions/create"
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@Scheduled(cron = "0 0 0 * * *")
|
||||
fun deleteExpiredTokens() {
|
||||
tokenService.deleteExpiredTokens()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user