mirror of https://github.com/usbharu/Hideout.git
feat: 通知のインターフェイスを作成
This commit is contained in:
parent
da0f38a608
commit
921de7ac87
|
@ -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
|
||||
)
|
|
@ -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
|
||||
}
|
|
@ -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
|
|
@ -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)
|
||||
}
|
Loading…
Reference in New Issue