Skip to content

Commit

Permalink
feat: 결석 스케쥴러에 알림 발송 추가 (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
ddingmin authored Jun 16, 2024
1 parent b26a528 commit 5bb8ebf
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
package com.depromeet.makers.domain.usecase

import com.depromeet.makers.domain.gateway.AttendanceGateway
import com.depromeet.makers.domain.gateway.NotificationGateway
import com.depromeet.makers.domain.gateway.SessionGateway
import com.depromeet.makers.domain.model.AttendanceStatus
import com.depromeet.makers.domain.model.Notification
import com.depromeet.makers.domain.model.NotificationType
import com.depromeet.makers.util.logger
import java.time.LocalDateTime

class UpdateAbsenceMember(
private val sessionGateway: SessionGateway,
private val attendanceGateway: AttendanceGateway,
private val notificationGateway: NotificationGateway,
) : UseCase<UpdateAbsenceMember.UpdateAbsenceMemberInput, Unit> {
data class UpdateAbsenceMemberInput(
val today: LocalDateTime,
Expand All @@ -29,6 +33,15 @@ class UpdateAbsenceMember(
}
.forEach {
attendanceGateway.save(it.copy(attendanceStatus = AttendanceStatus.ABSENCE))
notificationGateway.save(
Notification.newNotification(
memberId = it.member.memberId,
content = "출석 인증 시간이 초과되었습니다.\n" +
"출석 증빙은 담당 운영진에게 문의하세요.",
type = NotificationType.DOCUMENT,
createdAt = input.today,
)
)
logger.info("memberId: ${it.member.memberId} has been changed to ${AttendanceStatus.ATTENDANCE}")
}
}
Expand Down

0 comments on commit 5bb8ebf

Please sign in to comment.