This commit is contained in:
xds
2025-10-16 15:06:20 +03:00
commit 040da34ff7
78 changed files with 3934 additions and 0 deletions

View File

@@ -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()
}
}