feat: 通知のインターフェイスを作成

This commit is contained in:
usbharu 2024-01-26 21:08:37 +09:00
parent da0f38a608
commit 921de7ac87
4 changed files with 63 additions and 0 deletions

View File

@ -0,0 +1,12 @@
package dev.usbharu.hideout.core.domain.model.notification
import java.time.Instant
data class Notification(
val userId: Long,
val sourceActorId: Long?,
val postId: Long?,
val text: String?,
val reactionId: Long?,
val createdAt: Instant
)

View File

@ -0,0 +1,7 @@
package dev.usbharu.hideout.core.service.notification
import dev.usbharu.hideout.core.domain.model.relationship.Relationship
interface NotificationManagimentService {
fun sendNotification(relationship: Relationship, notificationRequest: NotificationRequest): Boolean
}

View File

@ -0,0 +1,36 @@
package dev.usbharu.hideout.core.service.notification
sealed class NotificationRequest(open val userId: Long, open val sourceActorId: Long)
interface PostId {
val postId: Long
}
data class MentionNotificationRequest(
override val userId: Long, override val sourceActorId: Long, override val postId: Long
) : NotificationRequest(
userId, sourceActorId
), PostId
data class PostNotificationRequest(
override val userId: Long, override val sourceActorId: Long, override val postId: Long
) : NotificationRequest(userId, sourceActorId), PostId
data class RepostNotificationRequest(
override val userId: Long, override val sourceActorId: Long, override val postId: Long
) : NotificationRequest(userId, sourceActorId), PostId
data class FollowNotificationRequest(
override val userId: Long, override val sourceActorId: Long, override val postId: Long
) : NotificationRequest(userId, sourceActorId), PostId
data class FollowRequestNotificationRequest(
override val userId: Long, override val sourceActorId: Long, override val postId: Long
) : NotificationRequest(userId, sourceActorId), PostId
data class ReactionNotificationRequest(
override val userId: Long, override val sourceActorId: Long, override val postId: Long, val reactionId: Long
) : NotificationRequest(userId, sourceActorId), PostId

View File

@ -0,0 +1,8 @@
package dev.usbharu.hideout.core.service.notification
import dev.usbharu.hideout.core.domain.model.notification.Notification
interface NotificationService {
suspend fun publishNotify(notificationRequest: NotificationRequest): Notification
suspend fun unpublishNotify(notificationId: Long)
}