This commit is contained in:
xds
2025-10-31 15:31:55 +03:00
parent 040da34ff7
commit 7972ea0fdf
117 changed files with 3691 additions and 2013 deletions

View File

@@ -1,35 +1,28 @@
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()
}
}
//
//@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()
// }
//
//
//}