Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/main/kotlin/com/moa/repository/FcmTokenRepository.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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<FcmToken, Long> {
fun findAllByMemberId(memberId: Long): List<FcmToken>
fun findByToken(token: String): FcmToken?

@Transactional
fun deleteByToken(token: String)
fun findAllByMemberIdIn(memberIds: Collection<Long>): List<FcmToken>
fun deleteAllByMemberId(memberId: Long)
Expand Down
Original file line number Diff line number Diff line change
@@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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)
}
Expand Down
Loading