-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/main/kotlin/com/depromeet/makers/domain/usecase/UpdateReadNotification.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.depromeet.makers.domain.usecase | ||
|
||
import com.depromeet.makers.domain.gateway.NotificationGateway | ||
import com.depromeet.makers.domain.model.Notification | ||
import java.time.LocalDateTime | ||
|
||
class UpdateReadNotification( | ||
private val notificationGateway: NotificationGateway, | ||
) : UseCase<UpdateReadNotification.UpdateReadNotificationInput, Notification> { | ||
|
||
data class UpdateReadNotificationInput( | ||
val notificationId: String, | ||
val memberId: String, | ||
val now: LocalDateTime = LocalDateTime.now(), | ||
) | ||
|
||
override fun execute(input: UpdateReadNotificationInput): Notification { | ||
val notification = notificationGateway.getById(input.notificationId) | ||
|
||
return notificationGateway.save( | ||
notification.copy( | ||
readAt = input.now | ||
) | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters