diff --git a/notification-domain/src/main/kotlin/io/github/v1servicenotification/detail/service/NotificationDetailApiImpl.kt b/notification-domain/src/main/kotlin/io/github/v1servicenotification/detail/service/NotificationDetailApiImpl.kt index 090b62c..52b7ed9 100644 --- a/notification-domain/src/main/kotlin/io/github/v1servicenotification/detail/service/NotificationDetailApiImpl.kt +++ b/notification-domain/src/main/kotlin/io/github/v1servicenotification/detail/service/NotificationDetailApiImpl.kt @@ -61,7 +61,8 @@ class NotificationDetailApiImpl( postDetailUserSpi.getDeviceTokenList(userIdList), category.title, content, - threadId + threadId, + category.destination ) } @@ -90,7 +91,8 @@ class NotificationDetailApiImpl( postDetailUserSpi.getDeviceTokenList(userIdList), category.title, content, - threadId + threadId, + category.destination ) } @@ -121,7 +123,7 @@ class NotificationDetailApiImpl( private fun sendMessage(category: Category, userId: UUID, topic: String, content: String, threadId: String) { if (category.defaultActivated && postDetailSettingRepositorySpi.findIsActivatedByUserIdAndTopic(userId, topic)) { // 기본값이 true면 Setting에서 false로 설정한 사람을 제외하고 발송한다. - postDetailFcmSpi.sendMessage(postDetailUserSpi.getDeviceToken(userId), category.title, content, threadId) + postDetailFcmSpi.sendMessage(postDetailUserSpi.getDeviceToken(userId), category.title, content, threadId, category.destination) } } diff --git a/notification-domain/src/main/kotlin/io/github/v1servicenotification/detail/spi/PostDetailFcmSpi.kt b/notification-domain/src/main/kotlin/io/github/v1servicenotification/detail/spi/PostDetailFcmSpi.kt index 151d4ca..dddac01 100644 --- a/notification-domain/src/main/kotlin/io/github/v1servicenotification/detail/spi/PostDetailFcmSpi.kt +++ b/notification-domain/src/main/kotlin/io/github/v1servicenotification/detail/spi/PostDetailFcmSpi.kt @@ -1,6 +1,6 @@ package io.github.v1servicenotification.detail.spi interface PostDetailFcmSpi { - fun sendMessage(token: String, title: String, content: String, threadId: String) - fun sendGroupMessage(tokenList: List, title: String, content: String, threadId: String) + fun sendMessage(token: String, title: String, content: String, threadId: String, destination: String) + fun sendGroupMessage(tokenList: List, title: String, content: String, threadId: String, destination: String) } diff --git a/notification-domain/src/main/kotlin/io/github/v1servicenotification/stubs/InMemoryFcm.kt b/notification-domain/src/main/kotlin/io/github/v1servicenotification/stubs/InMemoryFcm.kt index 5a42d87..050c1f0 100644 --- a/notification-domain/src/main/kotlin/io/github/v1servicenotification/stubs/InMemoryFcm.kt +++ b/notification-domain/src/main/kotlin/io/github/v1servicenotification/stubs/InMemoryFcm.kt @@ -3,11 +3,11 @@ package io.github.v1servicenotification.stubs import io.github.v1servicenotification.detail.spi.PostDetailFcmSpi class InMemoryFcm: PostDetailFcmSpi { - override fun sendMessage(token: String, title: String, content: String, threadId: String) { + override fun sendMessage(token: String, title: String, content: String, threadId: String, destination: String) { // TODO("Not yet implemented") } - override fun sendGroupMessage(tokenList: List, title: String, content: String, threadId: String) { + override fun sendGroupMessage(tokenList: List, title: String, content: String, threadId: String, destination: String) { // TODO("Not yet implemented") } } diff --git a/notification-infrastructure/src/main/kotlin/io/github/v1servicenotification/domain/category/domain/repository/CategoryRepository.kt b/notification-infrastructure/src/main/kotlin/io/github/v1servicenotification/domain/category/domain/repository/CategoryRepository.kt index 52a2b8e..276d202 100644 --- a/notification-infrastructure/src/main/kotlin/io/github/v1servicenotification/domain/category/domain/repository/CategoryRepository.kt +++ b/notification-infrastructure/src/main/kotlin/io/github/v1servicenotification/domain/category/domain/repository/CategoryRepository.kt @@ -9,6 +9,5 @@ import java.util.UUID interface CategoryRepository : CrudRepository { fun findAllByDefaultActivated(defaultActivated: Boolean): List fun existsByTopic(topic: String): Boolean - fun findByTopic(topic: String): CategoryEntity? } diff --git a/notification-infrastructure/src/main/kotlin/io/github/v1servicenotification/domain/notification/presentation/dto/Personal.kt b/notification-infrastructure/src/main/kotlin/io/github/v1servicenotification/domain/notification/presentation/dto/Personal.kt index a7dfab9..dd4cec2 100644 --- a/notification-infrastructure/src/main/kotlin/io/github/v1servicenotification/domain/notification/presentation/dto/Personal.kt +++ b/notification-infrastructure/src/main/kotlin/io/github/v1servicenotification/domain/notification/presentation/dto/Personal.kt @@ -13,5 +13,5 @@ data class Personal( val content: String, @JsonProperty("thread_id") - val threadId: String + val threadId: String, ) diff --git a/notification-infrastructure/src/main/kotlin/io/github/v1servicenotification/global/fcm/FcmService.kt b/notification-infrastructure/src/main/kotlin/io/github/v1servicenotification/global/fcm/FcmService.kt index 2e0d0f5..8fd632b 100644 --- a/notification-infrastructure/src/main/kotlin/io/github/v1servicenotification/global/fcm/FcmService.kt +++ b/notification-infrastructure/src/main/kotlin/io/github/v1servicenotification/global/fcm/FcmService.kt @@ -17,7 +17,7 @@ class FcmService: PostDetailFcmSpi { const val MAX_TOKEN_LENGTH = 163 } - override fun sendGroupMessage(tokenList: List, title: String, content: String, threadId: String) { + override fun sendGroupMessage(tokenList: List, title: String, content: String, threadId: String, destination: String) { val validTokens = tokenList.filter { it.length == MAX_TOKEN_LENGTH } if (validTokens.isNotEmpty()) { val multicast = MulticastMessage.builder() @@ -34,6 +34,7 @@ class FcmService: PostDetailFcmSpi { Aps.builder() .setSound("default") .setThreadId(threadId) + .putCustomData("destination", destination) .build() ).build() ) @@ -43,7 +44,7 @@ class FcmService: PostDetailFcmSpi { } } - override fun sendMessage(token: String, title: String, content: String, threadId: String) { + override fun sendMessage(token: String, title: String, content: String, threadId: String, destination: String) { if (token.length >= MAX_TOKEN_LENGTH) { val message = Message.builder() .setToken(token) @@ -59,6 +60,7 @@ class FcmService: PostDetailFcmSpi { Aps.builder() .setSound("default") .setThreadId(threadId) + .putCustomData("destination", destination) .build() ).build() )