diff --git a/src/main/kotlin/com/moa/repository/FcmTokenRepository.kt b/src/main/kotlin/com/moa/repository/FcmTokenRepository.kt index e36f4ce..446328a 100644 --- a/src/main/kotlin/com/moa/repository/FcmTokenRepository.kt +++ b/src/main/kotlin/com/moa/repository/FcmTokenRepository.kt @@ -2,10 +2,13 @@ package com.moa.repository import com.moa.entity.FcmToken import org.springframework.data.jpa.repository.JpaRepository +import org.springframework.transaction.annotation.Transactional interface FcmTokenRepository : JpaRepository { fun findAllByMemberId(memberId: Long): List fun findByToken(token: String): FcmToken? + + @Transactional fun deleteByToken(token: String) fun findAllByMemberIdIn(memberIds: Collection): List fun deleteAllByMemberId(memberId: Long) diff --git a/src/main/kotlin/com/moa/service/notification/NotificationBatchScheduler.kt b/src/main/kotlin/com/moa/service/notification/NotificationBatchScheduler.kt index 7efe628..3c84bc2 100644 --- a/src/main/kotlin/com/moa/service/notification/NotificationBatchScheduler.kt +++ b/src/main/kotlin/com/moa/service/notification/NotificationBatchScheduler.kt @@ -1,16 +1,21 @@ package com.moa.service.notification +import org.slf4j.LoggerFactory import org.springframework.scheduling.annotation.Scheduled import org.springframework.stereotype.Component import java.time.LocalDate +import java.time.LocalDateTime import java.time.ZoneId @Component class NotificationBatchScheduler( private val notificationBatchService: NotificationBatchService, ) { + private val log = LoggerFactory.getLogger(javaClass) + @Scheduled(cron = "0 0 0 * * *", zone = "Asia/Seoul") fun createDailyNotifications() { + log.info("{} : 출퇴근 알림 전송 배치 실행", LocalDateTime.now()) val today = LocalDate.now(ZoneId.of("Asia/Seoul")) notificationBatchService.generateNotificationsForDate(today) } diff --git a/src/main/kotlin/com/moa/service/notification/PaydayNotificationBatchScheduler.kt b/src/main/kotlin/com/moa/service/notification/PaydayNotificationBatchScheduler.kt index 0987bb3..6837b3d 100644 --- a/src/main/kotlin/com/moa/service/notification/PaydayNotificationBatchScheduler.kt +++ b/src/main/kotlin/com/moa/service/notification/PaydayNotificationBatchScheduler.kt @@ -1,16 +1,21 @@ package com.moa.service.notification +import org.slf4j.LoggerFactory import org.springframework.scheduling.annotation.Scheduled import org.springframework.stereotype.Component import java.time.LocalDate +import java.time.LocalDateTime import java.time.ZoneId @Component class PaydayNotificationBatchScheduler( private val paydayNotificationBatchService: PaydayNotificationBatchService, ) { + private val log = LoggerFactory.getLogger(javaClass) + @Scheduled(cron = "0 0 3 * * *", zone = "Asia/Seoul") fun createPaydayNotifications() { + log.info("{} : 월급 알림 전송 배치 실행", LocalDateTime.now()) val today = LocalDate.now(ZoneId.of("Asia/Seoul")) paydayNotificationBatchService.generateNotificationsForDate(today) }