diff --git a/src/main/kotlin/dev/usbharu/hideout/core/domain/model/notification/Notification.kt b/src/main/kotlin/dev/usbharu/hideout/core/domain/model/notification/Notification.kt new file mode 100644 index 00000000..e1b48e5d --- /dev/null +++ b/src/main/kotlin/dev/usbharu/hideout/core/domain/model/notification/Notification.kt @@ -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 +) diff --git a/src/main/kotlin/dev/usbharu/hideout/core/service/notification/NotificationManagimentService.kt b/src/main/kotlin/dev/usbharu/hideout/core/service/notification/NotificationManagimentService.kt new file mode 100644 index 00000000..3281087d --- /dev/null +++ b/src/main/kotlin/dev/usbharu/hideout/core/service/notification/NotificationManagimentService.kt @@ -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 +} diff --git a/src/main/kotlin/dev/usbharu/hideout/core/service/notification/NotificationRequest.kt b/src/main/kotlin/dev/usbharu/hideout/core/service/notification/NotificationRequest.kt new file mode 100644 index 00000000..3080c32e --- /dev/null +++ b/src/main/kotlin/dev/usbharu/hideout/core/service/notification/NotificationRequest.kt @@ -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 diff --git a/src/main/kotlin/dev/usbharu/hideout/core/service/notification/NotificationService.kt b/src/main/kotlin/dev/usbharu/hideout/core/service/notification/NotificationService.kt new file mode 100644 index 00000000..9c453e49 --- /dev/null +++ b/src/main/kotlin/dev/usbharu/hideout/core/service/notification/NotificationService.kt @@ -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) +}