From 8f7c9e4829ddaacab476dd9f6f38939fe7418538 Mon Sep 17 00:00:00 2001 From: twoosky Date: Mon, 27 Nov 2023 22:05:04 +0900 Subject: [PATCH 01/35] =?UTF-8?q?refacgtor:=20controller=20=EB=AA=A8?= =?UTF-8?q?=EB=93=88=EC=97=90=EC=84=9C=20responseDto=20=EB=B3=80=ED=99=98?= =?UTF-8?q?=ED=95=98=EB=8F=84=EB=A1=9D=20=EB=A6=AC=ED=8C=A9=ED=86=A0?= =?UTF-8?q?=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gloddy/fcmToken/port/in/FCMTokenCreateUseCase.kt | 4 ++-- .../gloddy/fcmToken/service/FCMTokenCreateService.kt | 6 ++---- .../gloddy/notification/port/in/NotificationGetUseCase.kt | 4 ++-- .../src/main/kotlin/gloddy/fcmToken/FCMTokenController.kt | 3 ++- .../kotlin/gloddy/fcmToken/dto/FCMTokenCreateResponse.kt | 3 +-- .../kotlin/gloddy/notification/NotificationController.kt | 5 +++-- .../gloddy/notification/dto/NotificationGetResponse.kt | 8 +++++--- 7 files changed, 17 insertions(+), 16 deletions(-) rename {notification-application => notification-in-adapter-api}/src/main/kotlin/gloddy/fcmToken/dto/FCMTokenCreateResponse.kt (76%) rename {notification-application => notification-in-adapter-api}/src/main/kotlin/gloddy/notification/dto/NotificationGetResponse.kt (76%) diff --git a/notification-application/src/main/kotlin/gloddy/fcmToken/port/in/FCMTokenCreateUseCase.kt b/notification-application/src/main/kotlin/gloddy/fcmToken/port/in/FCMTokenCreateUseCase.kt index 3af99c7..da5a5ea 100644 --- a/notification-application/src/main/kotlin/gloddy/fcmToken/port/in/FCMTokenCreateUseCase.kt +++ b/notification-application/src/main/kotlin/gloddy/fcmToken/port/in/FCMTokenCreateUseCase.kt @@ -1,9 +1,9 @@ package gloddy.fcmToken.port.`in` +import gloddy.fcmToken.FCMToken import gloddy.fcmToken.dto.FCMTokenCreateDto -import gloddy.fcmToken.dto.FCMTokenCreateResponse import gloddy.notification.UserId interface FCMTokenCreateUseCase { - fun create(userId: UserId, dto: FCMTokenCreateDto): FCMTokenCreateResponse + fun create(userId: UserId, dto: FCMTokenCreateDto): FCMToken } \ No newline at end of file diff --git a/notification-application/src/main/kotlin/gloddy/fcmToken/service/FCMTokenCreateService.kt b/notification-application/src/main/kotlin/gloddy/fcmToken/service/FCMTokenCreateService.kt index a49e82f..7d1b952 100644 --- a/notification-application/src/main/kotlin/gloddy/fcmToken/service/FCMTokenCreateService.kt +++ b/notification-application/src/main/kotlin/gloddy/fcmToken/service/FCMTokenCreateService.kt @@ -5,8 +5,6 @@ import gloddy.fcmToken.port.`in`.FCMTokenCreateUseCase import gloddy.fcmToken.port.out.FCMTokenCreatePort import gloddy.fcmToken.FCMToken import gloddy.fcmToken.FirebaseToken -import gloddy.fcmToken.dto.FCMTokenCreateResponse -import gloddy.fcmToken.dto.toDto import gloddy.notification.UserId import org.springframework.stereotype.Service @@ -15,11 +13,11 @@ class FCMTokenCreateService( private val fcmTokenCreatePort: FCMTokenCreatePort ): FCMTokenCreateUseCase { - override fun create(userId: UserId, dto: FCMTokenCreateDto): FCMTokenCreateResponse { + override fun create(userId: UserId, dto: FCMTokenCreateDto): FCMToken { val fcmToken = FCMToken( userId = userId, token = FirebaseToken(dto.token) ) - return fcmTokenCreatePort.create(fcmToken).toDto() + return fcmTokenCreatePort.create(fcmToken) } } \ No newline at end of file diff --git a/notification-application/src/main/kotlin/gloddy/notification/port/in/NotificationGetUseCase.kt b/notification-application/src/main/kotlin/gloddy/notification/port/in/NotificationGetUseCase.kt index 36e7cf4..fcb4ba4 100644 --- a/notification-application/src/main/kotlin/gloddy/notification/port/in/NotificationGetUseCase.kt +++ b/notification-application/src/main/kotlin/gloddy/notification/port/in/NotificationGetUseCase.kt @@ -1,8 +1,8 @@ package gloddy.notification.port.`in` +import gloddy.notification.Notification import gloddy.notification.dto.NotificationGetDto -import gloddy.notification.dto.NotificationResponse interface NotificationGetUseCase { - fun getAllByUser(dto: NotificationGetDto): NotificationResponse + fun getAllByUser(dto: NotificationGetDto): List } \ No newline at end of file diff --git a/notification-in-adapter-api/src/main/kotlin/gloddy/fcmToken/FCMTokenController.kt b/notification-in-adapter-api/src/main/kotlin/gloddy/fcmToken/FCMTokenController.kt index dfaf8bc..0b040df 100644 --- a/notification-in-adapter-api/src/main/kotlin/gloddy/fcmToken/FCMTokenController.kt +++ b/notification-in-adapter-api/src/main/kotlin/gloddy/fcmToken/FCMTokenController.kt @@ -2,6 +2,7 @@ package gloddy.fcmToken import gloddy.fcmToken.dto.FCMTokenCreateDto import gloddy.fcmToken.dto.FCMTokenCreateResponse +import gloddy.fcmToken.dto.toResponse import gloddy.fcmToken.port.`in`.FCMTokenCreateUseCase import gloddy.notification.UserId import org.springframework.web.bind.annotation.* @@ -16,6 +17,6 @@ class FCMTokenController( @RequestBody request: FCMTokenCreateDto, @RequestHeader("USER_ID") userId: UserId ): FCMTokenCreateResponse { - return fcmTokenCreateUseCase.create(userId, request) + return fcmTokenCreateUseCase.create(userId, request).toResponse() } } \ No newline at end of file diff --git a/notification-application/src/main/kotlin/gloddy/fcmToken/dto/FCMTokenCreateResponse.kt b/notification-in-adapter-api/src/main/kotlin/gloddy/fcmToken/dto/FCMTokenCreateResponse.kt similarity index 76% rename from notification-application/src/main/kotlin/gloddy/fcmToken/dto/FCMTokenCreateResponse.kt rename to notification-in-adapter-api/src/main/kotlin/gloddy/fcmToken/dto/FCMTokenCreateResponse.kt index 9467b53..1ecea42 100644 --- a/notification-application/src/main/kotlin/gloddy/fcmToken/dto/FCMTokenCreateResponse.kt +++ b/notification-in-adapter-api/src/main/kotlin/gloddy/fcmToken/dto/FCMTokenCreateResponse.kt @@ -3,14 +3,13 @@ package gloddy.fcmToken.dto import gloddy.fcmToken.FCMToken import gloddy.fcmToken.FirebaseToken import gloddy.notification.UserId -import gloddy.notification.dto.NotificationDto data class FCMTokenCreateResponse( val userId: UserId, val token: FirebaseToken ) -fun FCMToken.toDto(): FCMTokenCreateResponse = +fun FCMToken.toResponse(): FCMTokenCreateResponse = FCMTokenCreateResponse( userId = this.userId, token = this.token diff --git a/notification-in-adapter-api/src/main/kotlin/gloddy/notification/NotificationController.kt b/notification-in-adapter-api/src/main/kotlin/gloddy/notification/NotificationController.kt index d854575..a4385a5 100644 --- a/notification-in-adapter-api/src/main/kotlin/gloddy/notification/NotificationController.kt +++ b/notification-in-adapter-api/src/main/kotlin/gloddy/notification/NotificationController.kt @@ -1,6 +1,7 @@ package gloddy.notification import gloddy.notification.dto.NotificationGetDto +import gloddy.notification.dto.toResponse import gloddy.notification.port.`in`.NotificationGetUseCase import org.springframework.web.bind.annotation.GetMapping import org.springframework.web.bind.annotation.RequestHeader @@ -10,10 +11,10 @@ import org.springframework.web.bind.annotation.RestController @RestController @RequestMapping("/api/v1/notifications") class NotificationController( - private val notificationGetUseCase: NotificationGetUseCase + private val notificationGetUseCase: NotificationGetUseCase, ) { @GetMapping fun getAllByUser(@RequestHeader("USER_ID") userId: UserId) = - notificationGetUseCase.getAllByUser(NotificationGetDto(userId)) + notificationGetUseCase.getAllByUser(NotificationGetDto(userId)).toResponse() } \ No newline at end of file diff --git a/notification-application/src/main/kotlin/gloddy/notification/dto/NotificationGetResponse.kt b/notification-in-adapter-api/src/main/kotlin/gloddy/notification/dto/NotificationGetResponse.kt similarity index 76% rename from notification-application/src/main/kotlin/gloddy/notification/dto/NotificationGetResponse.kt rename to notification-in-adapter-api/src/main/kotlin/gloddy/notification/dto/NotificationGetResponse.kt index 6149c9c..dec01b2 100644 --- a/notification-application/src/main/kotlin/gloddy/notification/dto/NotificationGetResponse.kt +++ b/notification-in-adapter-api/src/main/kotlin/gloddy/notification/dto/NotificationGetResponse.kt @@ -4,19 +4,20 @@ import gloddy.notification.Notification import gloddy.notification.NotificationType import gloddy.notification.UserId -data class NotificationResponse( +data class NotificationGetResponse( val notifications: List ) data class NotificationDto( val userId: UserId, val redirectId: Long, + val title: String, val content: String, val type: NotificationType ) -fun List.toResponse(): NotificationResponse = - NotificationResponse( +fun List.toResponse(): NotificationGetResponse = + NotificationGetResponse( this.map { it.toDto() }.toList() ) @@ -24,6 +25,7 @@ fun Notification.toDto(): NotificationDto = NotificationDto( userId = this.userId, redirectId = this.redirectId, + title = this.title, content = this.content, type = this.type ) \ No newline at end of file From 885615e0848778ae65c2526839af845afeeab997 Mon Sep 17 00:00:00 2001 From: twoosky Date: Mon, 27 Nov 2023 22:06:24 +0900 Subject: [PATCH 02/35] =?UTF-8?q?fix:=20notification=20=EB=8F=84=EB=A9=94?= =?UTF-8?q?=EC=9D=B8=20=EC=83=9D=EC=84=B1=20=EB=A1=9C=EC=A7=81=EC=97=90=20?= =?UTF-8?q?title=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../notification/service/ApplyNotificationCreateService.kt | 1 + .../notification/service/GroupNotificationCreateService.kt | 3 +++ .../gloddy/notification/service/NotificationGetService.kt | 7 +++---- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/notification-application/src/main/kotlin/gloddy/notification/service/ApplyNotificationCreateService.kt b/notification-application/src/main/kotlin/gloddy/notification/service/ApplyNotificationCreateService.kt index ff4688c..c2c814d 100644 --- a/notification-application/src/main/kotlin/gloddy/notification/service/ApplyNotificationCreateService.kt +++ b/notification-application/src/main/kotlin/gloddy/notification/service/ApplyNotificationCreateService.kt @@ -21,6 +21,7 @@ class ApplyNotificationCreateService( Notification( redirectId = applyEvent.applyGroupId, userId = getTargetUserId(type, applyEvent), + title = type.title, content = type.content, type = type ).run { diff --git a/notification-application/src/main/kotlin/gloddy/notification/service/GroupNotificationCreateService.kt b/notification-application/src/main/kotlin/gloddy/notification/service/GroupNotificationCreateService.kt index 77da1f6..7857915 100644 --- a/notification-application/src/main/kotlin/gloddy/notification/service/GroupNotificationCreateService.kt +++ b/notification-application/src/main/kotlin/gloddy/notification/service/GroupNotificationCreateService.kt @@ -25,6 +25,7 @@ class GroupNotificationCreateService( Notification( redirectId = groupEvent.groupId, userId = groupEvent.userId, + title = notificationType.title, content = notificationType.getContent(), type = notificationType ).run { @@ -40,6 +41,7 @@ class GroupNotificationCreateService( Notification( userId = it, redirectId = event.groupId, + title = notificationType.title, content = notificationType.content, type = notificationType ).run { @@ -56,6 +58,7 @@ class GroupNotificationCreateService( Notification( userId = it, redirectId = event.groupId, + title = notificationType.title, content = notificationType.content, type = notificationType ).run { diff --git a/notification-application/src/main/kotlin/gloddy/notification/service/NotificationGetService.kt b/notification-application/src/main/kotlin/gloddy/notification/service/NotificationGetService.kt index eeb3220..d1fda1c 100644 --- a/notification-application/src/main/kotlin/gloddy/notification/service/NotificationGetService.kt +++ b/notification-application/src/main/kotlin/gloddy/notification/service/NotificationGetService.kt @@ -1,8 +1,7 @@ package gloddy.notification.service +import gloddy.notification.Notification import gloddy.notification.dto.NotificationGetDto -import gloddy.notification.dto.NotificationResponse -import gloddy.notification.dto.toResponse import gloddy.notification.port.`in`.NotificationGetUseCase import gloddy.notification.port.out.NotificationGetPort import org.springframework.stereotype.Service @@ -12,7 +11,7 @@ class NotificationGetService( private val notificationGetPort: NotificationGetPort ): NotificationGetUseCase { - override fun getAllByUser(dto: NotificationGetDto): NotificationResponse = - notificationGetPort.findByUserId(dto.userId).toResponse() + override fun getAllByUser(dto: NotificationGetDto): List = + notificationGetPort.findByUserId(dto.userId) } \ No newline at end of file From d13c4cec407511543699d89243d4e864f41d8b0c Mon Sep 17 00:00:00 2001 From: twoosky Date: Mon, 27 Nov 2023 22:07:06 +0900 Subject: [PATCH 03/35] =?UTF-8?q?feat:=20notificaiton=20=EB=8F=84=EB=A9=94?= =?UTF-8?q?=EC=9D=B8=EC=97=90=20id=20=ED=95=84=EB=93=9C=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/kotlin/gloddy/notification/Notification.kt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/notification-domain/src/main/kotlin/gloddy/notification/Notification.kt b/notification-domain/src/main/kotlin/gloddy/notification/Notification.kt index 8dff9eb..02059fc 100644 --- a/notification-domain/src/main/kotlin/gloddy/notification/Notification.kt +++ b/notification-domain/src/main/kotlin/gloddy/notification/Notification.kt @@ -1,12 +1,19 @@ package gloddy.notification +import java.util.* + @JvmInline value class UserId(val value: Long) +@JvmInline +value class NotificationId(val value: String) + data class Notification( + val id: NotificationId = NotificationId(UUID.randomUUID().toString()), val userId: UserId, val redirectId: Long, + val title: String, val content: String, val type: NotificationType ) \ No newline at end of file From 1172052b926c8b3dea5876b970322171aee8088c Mon Sep 17 00:00:00 2001 From: twoosky Date: Mon, 27 Nov 2023 22:07:18 +0900 Subject: [PATCH 04/35] =?UTF-8?q?feat:=20NotificationType=EC=97=90=20title?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gloddy/notification/NotificationType.kt | 37 +++++++++++++++---- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/notification-domain/src/main/kotlin/gloddy/notification/NotificationType.kt b/notification-domain/src/main/kotlin/gloddy/notification/NotificationType.kt index de4a94b..9a0a24e 100644 --- a/notification-domain/src/main/kotlin/gloddy/notification/NotificationType.kt +++ b/notification-domain/src/main/kotlin/gloddy/notification/NotificationType.kt @@ -1,17 +1,40 @@ package gloddy.notification enum class NotificationType( + val title: String, val content: String ) { - APPLY_APPROVE("Your applied gathering has been approved! \uD83D\uDC4C"), - APPLY_REFUSE("The gathering you applied for has been declined. \uD83E\uDD72"), - APPLY_CREATE("A new gathering application has arrived! \uD83D\uDC8C"), - GROUP_LEAVE("has just left the group. \uD83E\uDD72"), - GROUP_ARTICLE_CREATE("Please Check the New Notice! \uD83D\uDDE3"), - GROUP_APPROACHING_START("The gathering starts in 1 hour! ⏰"), - GROUP_END("Did you enjoy the gathering? \uD83D\uDE06") + APPLY_APPROVE( + "👌Your applied gathering has been approved!", + "Wishing you enjoy a fun and safe gathering." + ), + APPLY_REFUSE( + "😢The gathering you applied for has been declined.", + "There are various other gatherings available for you! Would you like to look for another gathering?" + ), + APPLY_CREATE( + "💌A new gathering application has arrived!", + "We’re awaiting the host’s approval for the gathering! please warmly welcome the new members." + ), + GROUP_LEAVE( + "😢has just left the group.", + "Shall we go check the group participants?" + ), + GROUP_ARTICLE_CREATE( + "🗣️Please Check the New Notice!", + "A new post has been added." + ), + GROUP_APPROACHING_START( + "⏰The gathering starts in 1 hour!", + "Are you ready to enjoy the gathering? \n" + "Check the announcement for a better gathering!" + ), + GROUP_END( + "😆Did you enjoy the gathering?", + "Please rate the attendees of the gathering! \n" + "Select the best partner with reward stickers." + ) ; + companion object { fun of(type: String): NotificationType { return values().firstOrNull { it.name == type } From 2511cad3f5954887f2830100bef7e592c9825fb3 Mon Sep 17 00:00:00 2001 From: twoosky Date: Mon, 27 Nov 2023 22:07:39 +0900 Subject: [PATCH 05/35] =?UTF-8?q?feat:=20notification=20entity=EC=97=90=20?= =?UTF-8?q?title=20=EC=BB=AC=EB=9F=BC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gloddy/dynamodb/notification/NotificationEntity.kt | 3 +++ .../gloddy/dynamodb/notification/NotificationMapper.kt | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/notification-out-adapter-persistence/src/main/kotlin/gloddy/dynamodb/notification/NotificationEntity.kt b/notification-out-adapter-persistence/src/main/kotlin/gloddy/dynamodb/notification/NotificationEntity.kt index b3ba538..72cb324 100644 --- a/notification-out-adapter-persistence/src/main/kotlin/gloddy/dynamodb/notification/NotificationEntity.kt +++ b/notification-out-adapter-persistence/src/main/kotlin/gloddy/dynamodb/notification/NotificationEntity.kt @@ -21,6 +21,9 @@ class NotificationEntity( @field:DynamoDBAttribute(attributeName = "redirect_id") var redirectId: String = "", + @field:DynamoDBAttribute(attributeName = "title") + var title: String = "", + @field:DynamoDBAttribute(attributeName = "content") var content: String = "", diff --git a/notification-out-adapter-persistence/src/main/kotlin/gloddy/dynamodb/notification/NotificationMapper.kt b/notification-out-adapter-persistence/src/main/kotlin/gloddy/dynamodb/notification/NotificationMapper.kt index 0fd39da..a07cdf2 100644 --- a/notification-out-adapter-persistence/src/main/kotlin/gloddy/dynamodb/notification/NotificationMapper.kt +++ b/notification-out-adapter-persistence/src/main/kotlin/gloddy/dynamodb/notification/NotificationMapper.kt @@ -1,21 +1,26 @@ package gloddy.dynamodb.notification import gloddy.notification.Notification +import gloddy.notification.NotificationId import gloddy.notification.UserId fun NotificationEntity.toDomain(): Notification = Notification( + id = NotificationId(this.id), userId = UserId(this.userId.toLong()), redirectId = this.redirectId.toLong(), + title = this.title, content = this.content, type = this.type!! ) fun Notification.toEntity(): NotificationEntity = NotificationEntity( + id = this.id.value, userId = this.userId.value.toString(), redirectId = this.redirectId.toString(), + title = this.title, content = this.content, type = this.type ) \ No newline at end of file From 1bc803bcc6ef77b3f4a67831390cd3fb66407f46 Mon Sep 17 00:00:00 2001 From: twoosky Date: Mon, 27 Nov 2023 22:08:57 +0900 Subject: [PATCH 06/35] =?UTF-8?q?feat:=20async=20=EC=8A=A4=EB=A0=88?= =?UTF-8?q?=EB=93=9C=20=ED=92=80=20bean=20=EB=93=B1=EB=A1=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gloddy/config/AsyncThreadConfiguration.kt | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 push/src/main/kotlin/gloddy/config/AsyncThreadConfiguration.kt diff --git a/push/src/main/kotlin/gloddy/config/AsyncThreadConfiguration.kt b/push/src/main/kotlin/gloddy/config/AsyncThreadConfiguration.kt new file mode 100644 index 0000000..9c2d075 --- /dev/null +++ b/push/src/main/kotlin/gloddy/config/AsyncThreadConfiguration.kt @@ -0,0 +1,25 @@ +package gloddy.config + +import org.springframework.context.annotation.Bean +import org.springframework.context.annotation.Configuration +import org.springframework.scheduling.annotation.EnableAsync +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor +import java.util.concurrent.Executor + +@Configuration +@EnableAsync +class AsyncThreadConfiguration { + + companion object { + private const val THREAD_NAME_PREFIX = "ASYNC-THREAD-" + } + + @Bean + fun asyncThreadTaskExecutor(): Executor { + return ThreadPoolTaskExecutor().apply { + corePoolSize = 9 + maxPoolSize = 9 + setThreadNamePrefix(THREAD_NAME_PREFIX) + } + } +} \ No newline at end of file From 9c0a75aa18f06d24914ad823e03ac926ed08de8e Mon Sep 17 00:00:00 2001 From: twoosky Date: Mon, 27 Nov 2023 22:09:48 +0900 Subject: [PATCH 07/35] =?UTF-8?q?fix:=20fcm=20title=20=EC=83=81=EC=88=98?= =?UTF-8?q?=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- push/src/main/kotlin/gloddy/NotificationPushService.kt | 5 ----- 1 file changed, 5 deletions(-) diff --git a/push/src/main/kotlin/gloddy/NotificationPushService.kt b/push/src/main/kotlin/gloddy/NotificationPushService.kt index e50d61c..4105068 100644 --- a/push/src/main/kotlin/gloddy/NotificationPushService.kt +++ b/push/src/main/kotlin/gloddy/NotificationPushService.kt @@ -3,8 +3,6 @@ package gloddy import gloddy.command.PushCommand import gloddy.dynamodb.fcmToken.FCMTokenQueryAdapter import gloddy.fcmToken.FirebaseToken -import gloddy.notification.Notification -import gloddy.notification.NotificationType import org.springframework.stereotype.Component @Component @@ -12,9 +10,6 @@ class NotificationPushService( private val pushClient: PushClient, private val fcmTokenQueryAdapter: FCMTokenQueryAdapter ) { - companion object { - const val PUSH_TITLE = "Gloddy" - } fun push(pushCommand: PushCommand) { val fcmToken = fcmTokenQueryAdapter.get(pushCommand.userId) From aa984aaeedbf27652113d731737dea974270e0c1 Mon Sep 17 00:00:00 2001 From: twoosky Date: Mon, 27 Nov 2023 22:10:28 +0900 Subject: [PATCH 08/35] =?UTF-8?q?feat:=20push=20=EC=9D=B4=EB=B2=A4?= =?UTF-8?q?=ED=8A=B8=20=EB=B9=84=EB=8F=99=EA=B8=B0=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- push/src/main/kotlin/gloddy/event/NotificationEventListener.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/push/src/main/kotlin/gloddy/event/NotificationEventListener.kt b/push/src/main/kotlin/gloddy/event/NotificationEventListener.kt index 8c13838..4505853 100644 --- a/push/src/main/kotlin/gloddy/event/NotificationEventListener.kt +++ b/push/src/main/kotlin/gloddy/event/NotificationEventListener.kt @@ -4,6 +4,7 @@ import gloddy.NotificationPushService import gloddy.command.toGroupingPushCommand import gloddy.notification.event.NotificationCreateEvent import org.springframework.context.event.EventListener +import org.springframework.scheduling.annotation.Async import org.springframework.stereotype.Component @Component @@ -11,6 +12,7 @@ class NotificationEventListener( private val notificationPushService: NotificationPushService ) { + @Async @EventListener fun consume(event: NotificationCreateEvent) { notificationPushService.push(event.toGroupingPushCommand()) From a7afbeebc4097eb538b2a798f74252e77c4d051b Mon Sep 17 00:00:00 2001 From: twoosky Date: Mon, 27 Nov 2023 22:48:31 +0900 Subject: [PATCH 09/35] =?UTF-8?q?fix:=20async=20=EC=8A=A4=EB=A0=88?= =?UTF-8?q?=EB=93=9C=20=ED=92=80=20bean=20=EC=9D=B4=EB=A6=84=20=EC=98=B5?= =?UTF-8?q?=EC=85=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...dConfiguration.kt => AsyncConfiguration.kt} | 18 ++++++++++-------- .../gloddy/event/NotificationEventListener.kt | 2 +- 2 files changed, 11 insertions(+), 9 deletions(-) rename push/src/main/kotlin/gloddy/config/{AsyncThreadConfiguration.kt => AsyncConfiguration.kt} (50%) diff --git a/push/src/main/kotlin/gloddy/config/AsyncThreadConfiguration.kt b/push/src/main/kotlin/gloddy/config/AsyncConfiguration.kt similarity index 50% rename from push/src/main/kotlin/gloddy/config/AsyncThreadConfiguration.kt rename to push/src/main/kotlin/gloddy/config/AsyncConfiguration.kt index 9c2d075..e0e8c53 100644 --- a/push/src/main/kotlin/gloddy/config/AsyncThreadConfiguration.kt +++ b/push/src/main/kotlin/gloddy/config/AsyncConfiguration.kt @@ -2,24 +2,26 @@ package gloddy.config import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.scheduling.annotation.AsyncConfigurer import org.springframework.scheduling.annotation.EnableAsync import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor import java.util.concurrent.Executor @Configuration @EnableAsync -class AsyncThreadConfiguration { +class AsyncConfiguration : AsyncConfigurer { companion object { private const val THREAD_NAME_PREFIX = "ASYNC-THREAD-" } - @Bean - fun asyncThreadTaskExecutor(): Executor { - return ThreadPoolTaskExecutor().apply { - corePoolSize = 9 - maxPoolSize = 9 - setThreadNamePrefix(THREAD_NAME_PREFIX) - } + @Bean(name = ["PUSH-EVENT-ASYNC-EXECUTOR"]) + override fun getAsyncExecutor(): Executor { + val executor = ThreadPoolTaskExecutor() + executor.setThreadNamePrefix(THREAD_NAME_PREFIX) + executor.corePoolSize = 9 + executor.maxPoolSize = 9 + executor.initialize() + return executor } } \ No newline at end of file diff --git a/push/src/main/kotlin/gloddy/event/NotificationEventListener.kt b/push/src/main/kotlin/gloddy/event/NotificationEventListener.kt index 4505853..c82336a 100644 --- a/push/src/main/kotlin/gloddy/event/NotificationEventListener.kt +++ b/push/src/main/kotlin/gloddy/event/NotificationEventListener.kt @@ -12,7 +12,7 @@ class NotificationEventListener( private val notificationPushService: NotificationPushService ) { - @Async + @Async("PUSH-EVENT-ASYNC-EXECUTOR") @EventListener fun consume(event: NotificationCreateEvent) { notificationPushService.push(event.toGroupingPushCommand()) From fa8c56fe191b6d2ed3c911702a4aaba75494a574 Mon Sep 17 00:00:00 2001 From: twoosky Date: Tue, 28 Nov 2023 02:38:20 +0900 Subject: [PATCH 10/35] =?UTF-8?q?fix:=20thread=20pool=20size=20=EC=A1=B0?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- push/src/main/kotlin/gloddy/config/AsyncConfiguration.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/push/src/main/kotlin/gloddy/config/AsyncConfiguration.kt b/push/src/main/kotlin/gloddy/config/AsyncConfiguration.kt index e0e8c53..c256f7a 100644 --- a/push/src/main/kotlin/gloddy/config/AsyncConfiguration.kt +++ b/push/src/main/kotlin/gloddy/config/AsyncConfiguration.kt @@ -12,15 +12,16 @@ import java.util.concurrent.Executor class AsyncConfiguration : AsyncConfigurer { companion object { - private const val THREAD_NAME_PREFIX = "ASYNC-THREAD-" + private const val PUSH_THREAD_NAME_PREFIX = "PUSH-ASYNC-THREAD-" } @Bean(name = ["PUSH-EVENT-ASYNC-EXECUTOR"]) override fun getAsyncExecutor(): Executor { val executor = ThreadPoolTaskExecutor() - executor.setThreadNamePrefix(THREAD_NAME_PREFIX) - executor.corePoolSize = 9 + executor.setThreadNamePrefix(PUSH_THREAD_NAME_PREFIX) + executor.corePoolSize = 2 executor.maxPoolSize = 9 + executor.queueCapacity = 5 executor.initialize() return executor } From 1aca701413dcb48060f7086301d34f7cdea8d0ec Mon Sep 17 00:00:00 2001 From: twoosky Date: Tue, 28 Nov 2023 02:53:43 +0900 Subject: [PATCH 11/35] =?UTF-8?q?fix:=20thread=20pool=20size=20=EC=A1=B0?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- push/src/main/kotlin/gloddy/config/AsyncConfiguration.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/push/src/main/kotlin/gloddy/config/AsyncConfiguration.kt b/push/src/main/kotlin/gloddy/config/AsyncConfiguration.kt index c256f7a..b686720 100644 --- a/push/src/main/kotlin/gloddy/config/AsyncConfiguration.kt +++ b/push/src/main/kotlin/gloddy/config/AsyncConfiguration.kt @@ -20,7 +20,7 @@ class AsyncConfiguration : AsyncConfigurer { val executor = ThreadPoolTaskExecutor() executor.setThreadNamePrefix(PUSH_THREAD_NAME_PREFIX) executor.corePoolSize = 2 - executor.maxPoolSize = 9 + executor.maxPoolSize = 10 executor.queueCapacity = 5 executor.initialize() return executor From 4e5ffb1787002107d958f27b8c19baf7789cd3f1 Mon Sep 17 00:00:00 2001 From: twoosky Date: Wed, 29 Nov 2023 18:25:01 +0900 Subject: [PATCH 12/35] =?UTF-8?q?fix:=20queueCapacity=20=EC=98=B5=EC=85=98?= =?UTF-8?q?=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- push/src/main/kotlin/gloddy/config/AsyncConfiguration.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/push/src/main/kotlin/gloddy/config/AsyncConfiguration.kt b/push/src/main/kotlin/gloddy/config/AsyncConfiguration.kt index b686720..c75958f 100644 --- a/push/src/main/kotlin/gloddy/config/AsyncConfiguration.kt +++ b/push/src/main/kotlin/gloddy/config/AsyncConfiguration.kt @@ -19,9 +19,8 @@ class AsyncConfiguration : AsyncConfigurer { override fun getAsyncExecutor(): Executor { val executor = ThreadPoolTaskExecutor() executor.setThreadNamePrefix(PUSH_THREAD_NAME_PREFIX) - executor.corePoolSize = 2 + executor.corePoolSize = 10 executor.maxPoolSize = 10 - executor.queueCapacity = 5 executor.initialize() return executor } From b8041960b1ada85deec43fe787c8f600284e5d43 Mon Sep 17 00:00:00 2001 From: twoosky Date: Fri, 1 Dec 2023 02:40:19 +0900 Subject: [PATCH 13/35] =?UTF-8?q?fix:=20=EC=95=A0=ED=94=8C=EB=A6=AC?= =?UTF-8?q?=EC=BC=80=EC=9D=B4=EC=85=98=20=EB=A0=88=EB=B2=A8=20=EC=8A=A4?= =?UTF-8?q?=EB=A0=88=EB=93=9C=20=ED=92=80=20=EC=84=A4=EC=A0=95=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kotlin/gloddy/config/AsyncConfiguration.kt | 14 ++++++-------- .../gloddy/event/NotificationEventListener.kt | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/push/src/main/kotlin/gloddy/config/AsyncConfiguration.kt b/push/src/main/kotlin/gloddy/config/AsyncConfiguration.kt index c75958f..40bd9e4 100644 --- a/push/src/main/kotlin/gloddy/config/AsyncConfiguration.kt +++ b/push/src/main/kotlin/gloddy/config/AsyncConfiguration.kt @@ -2,26 +2,24 @@ package gloddy.config import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration -import org.springframework.scheduling.annotation.AsyncConfigurer import org.springframework.scheduling.annotation.EnableAsync import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor import java.util.concurrent.Executor @Configuration @EnableAsync -class AsyncConfiguration : AsyncConfigurer { +class AsyncConfiguration { companion object { - private const val PUSH_THREAD_NAME_PREFIX = "PUSH-ASYNC-THREAD-" + private const val PUSH_THREAD_NAME_PREFIX = "PUSH-THREAD-" } - @Bean(name = ["PUSH-EVENT-ASYNC-EXECUTOR"]) - override fun getAsyncExecutor(): Executor { + @Bean(name = ["pushThreadPoolTaskExecutor"]) + fun pushThreadPoolTaskExecutor(): Executor { val executor = ThreadPoolTaskExecutor() executor.setThreadNamePrefix(PUSH_THREAD_NAME_PREFIX) - executor.corePoolSize = 10 - executor.maxPoolSize = 10 - executor.initialize() + executor.corePoolSize = 9 + executor.maxPoolSize = 9 return executor } } \ No newline at end of file diff --git a/push/src/main/kotlin/gloddy/event/NotificationEventListener.kt b/push/src/main/kotlin/gloddy/event/NotificationEventListener.kt index c82336a..b798bb3 100644 --- a/push/src/main/kotlin/gloddy/event/NotificationEventListener.kt +++ b/push/src/main/kotlin/gloddy/event/NotificationEventListener.kt @@ -12,7 +12,7 @@ class NotificationEventListener( private val notificationPushService: NotificationPushService ) { - @Async("PUSH-EVENT-ASYNC-EXECUTOR") + @Async("pushThreadPoolTaskExecutor") @EventListener fun consume(event: NotificationCreateEvent) { notificationPushService.push(event.toGroupingPushCommand()) From 16bb5530b698fa42aec70fee260a19b9c4911c00 Mon Sep 17 00:00:00 2001 From: twoosky Date: Wed, 6 Dec 2023 06:23:50 +0900 Subject: [PATCH 14/35] =?UTF-8?q?feat:=20payload=20response=20dto=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../group/{GroupStatusPayload.kt => GroupPayload.kt} | 0 ...GroupStatusPayloadType.kt => GroupPayloadType.kt} | 0 .../kotlin/gloddy/notification/dto/ApplyEvent.kt | 11 ----------- .../gloddy/notification/dto/GroupArticleEvent.kt | 11 ----------- .../kotlin/gloddy/notification/dto/GroupEvent.kt | 10 ---------- .../gloddy/notification/dto/GroupPayloadDto.kt | 5 ----- .../gloddy/notification/dto/GroupStatusEvent.kt | 9 --------- .../gloddy/notification/dto/GroupStatusEventType.kt | 6 ------ .../gloddy/notification/dto/event/ApplyEvent.kt | 11 +++++++++++ .../notification/dto/event/GroupArticleEvent.kt | 10 ++++++++++ .../gloddy/notification/dto/event/GroupEvent.kt | 12 ++++++++++++ .../notification/dto/event/GroupMemberEvent.kt | 9 +++++++++ .../dto/event/eventType}/ApplyEventType.kt | 2 +- .../{ => event/eventType}/GroupArticleEventType.kt | 2 +- .../dto/event/eventType/GroupEventType.kt | 6 ++++++ .../dto/event/eventType/GroupMemberEventType.kt | 5 +++++ .../gloddy/notification/dto/payload/ApplyPayload.kt | 8 ++++++++ .../notification/dto/payload/GroupArticlePayload.kt | 11 +++++++++++ .../notification/dto/payload/GroupMemberIds.kt | 4 ++++ .../notification/dto/payload/GroupMemberPayload.kt | 8 ++++++++ .../gloddy/notification/dto/payload/GroupPayload.kt | 8 ++++++++ .../kotlin/gloddy/notification/GroupEventType.kt | 5 ----- .../gloddy/openFeign/{ => config}/OpenFeignConfig.kt | 0 .../{application.yml => application-internal.yml} | 0 24 files changed, 94 insertions(+), 59 deletions(-) rename in-adapter-messaging/src/main/kotlin/gloddy/payload/group/{GroupStatusPayload.kt => GroupPayload.kt} (100%) rename in-adapter-messaging/src/main/kotlin/gloddy/payload/group/{GroupStatusPayloadType.kt => GroupPayloadType.kt} (100%) delete mode 100644 notification-application/src/main/kotlin/gloddy/notification/dto/ApplyEvent.kt delete mode 100644 notification-application/src/main/kotlin/gloddy/notification/dto/GroupArticleEvent.kt delete mode 100644 notification-application/src/main/kotlin/gloddy/notification/dto/GroupEvent.kt delete mode 100644 notification-application/src/main/kotlin/gloddy/notification/dto/GroupPayloadDto.kt delete mode 100644 notification-application/src/main/kotlin/gloddy/notification/dto/GroupStatusEvent.kt delete mode 100644 notification-application/src/main/kotlin/gloddy/notification/dto/GroupStatusEventType.kt create mode 100644 notification-application/src/main/kotlin/gloddy/notification/dto/event/ApplyEvent.kt create mode 100644 notification-application/src/main/kotlin/gloddy/notification/dto/event/GroupArticleEvent.kt create mode 100644 notification-application/src/main/kotlin/gloddy/notification/dto/event/GroupEvent.kt create mode 100644 notification-application/src/main/kotlin/gloddy/notification/dto/event/GroupMemberEvent.kt rename {notification-domain/src/main/kotlin/gloddy/notification => notification-application/src/main/kotlin/gloddy/notification/dto/event/eventType}/ApplyEventType.kt (66%) rename notification-application/src/main/kotlin/gloddy/notification/dto/{ => event/eventType}/GroupArticleEventType.kt (59%) create mode 100644 notification-application/src/main/kotlin/gloddy/notification/dto/event/eventType/GroupEventType.kt create mode 100644 notification-application/src/main/kotlin/gloddy/notification/dto/event/eventType/GroupMemberEventType.kt create mode 100644 notification-application/src/main/kotlin/gloddy/notification/dto/payload/ApplyPayload.kt create mode 100644 notification-application/src/main/kotlin/gloddy/notification/dto/payload/GroupArticlePayload.kt create mode 100644 notification-application/src/main/kotlin/gloddy/notification/dto/payload/GroupMemberIds.kt create mode 100644 notification-application/src/main/kotlin/gloddy/notification/dto/payload/GroupMemberPayload.kt create mode 100644 notification-application/src/main/kotlin/gloddy/notification/dto/payload/GroupPayload.kt delete mode 100644 notification-domain/src/main/kotlin/gloddy/notification/GroupEventType.kt rename out-internal-api/src/main/kotlin/gloddy/openFeign/{ => config}/OpenFeignConfig.kt (100%) rename out-internal-api/src/main/resources/{application.yml => application-internal.yml} (100%) diff --git a/in-adapter-messaging/src/main/kotlin/gloddy/payload/group/GroupStatusPayload.kt b/in-adapter-messaging/src/main/kotlin/gloddy/payload/group/GroupPayload.kt similarity index 100% rename from in-adapter-messaging/src/main/kotlin/gloddy/payload/group/GroupStatusPayload.kt rename to in-adapter-messaging/src/main/kotlin/gloddy/payload/group/GroupPayload.kt diff --git a/in-adapter-messaging/src/main/kotlin/gloddy/payload/group/GroupStatusPayloadType.kt b/in-adapter-messaging/src/main/kotlin/gloddy/payload/group/GroupPayloadType.kt similarity index 100% rename from in-adapter-messaging/src/main/kotlin/gloddy/payload/group/GroupStatusPayloadType.kt rename to in-adapter-messaging/src/main/kotlin/gloddy/payload/group/GroupPayloadType.kt diff --git a/notification-application/src/main/kotlin/gloddy/notification/dto/ApplyEvent.kt b/notification-application/src/main/kotlin/gloddy/notification/dto/ApplyEvent.kt deleted file mode 100644 index 8f7b445..0000000 --- a/notification-application/src/main/kotlin/gloddy/notification/dto/ApplyEvent.kt +++ /dev/null @@ -1,11 +0,0 @@ -package gloddy.notification.dto - -import gloddy.notification.ApplyEventType -import gloddy.notification.UserId - -data class ApplyEvent( - val userId: UserId, - val applyGroupId: Long, - val applyUserId: UserId, - val eventType: ApplyEventType -) \ No newline at end of file diff --git a/notification-application/src/main/kotlin/gloddy/notification/dto/GroupArticleEvent.kt b/notification-application/src/main/kotlin/gloddy/notification/dto/GroupArticleEvent.kt deleted file mode 100644 index 62e2ded..0000000 --- a/notification-application/src/main/kotlin/gloddy/notification/dto/GroupArticleEvent.kt +++ /dev/null @@ -1,11 +0,0 @@ -package gloddy.notification.dto - -import gloddy.notification.UserId - -data class GroupArticleEvent( - val userId: UserId, - val groupId: Long, - val groupMemberUserIds: List, - val articleId: Long, - val eventType: GroupArticleEventType -) diff --git a/notification-application/src/main/kotlin/gloddy/notification/dto/GroupEvent.kt b/notification-application/src/main/kotlin/gloddy/notification/dto/GroupEvent.kt deleted file mode 100644 index c190e38..0000000 --- a/notification-application/src/main/kotlin/gloddy/notification/dto/GroupEvent.kt +++ /dev/null @@ -1,10 +0,0 @@ -package gloddy.notification.dto - -import gloddy.notification.GroupEventType -import gloddy.notification.UserId - -data class GroupEvent( - val userId: UserId, - val groupId: Long, - val eventType: GroupEventType -) \ No newline at end of file diff --git a/notification-application/src/main/kotlin/gloddy/notification/dto/GroupPayloadDto.kt b/notification-application/src/main/kotlin/gloddy/notification/dto/GroupPayloadDto.kt deleted file mode 100644 index a4fc7be..0000000 --- a/notification-application/src/main/kotlin/gloddy/notification/dto/GroupPayloadDto.kt +++ /dev/null @@ -1,5 +0,0 @@ -package gloddy.notification.dto - -data class GroupPayloadDto( - val userName: String -) \ No newline at end of file diff --git a/notification-application/src/main/kotlin/gloddy/notification/dto/GroupStatusEvent.kt b/notification-application/src/main/kotlin/gloddy/notification/dto/GroupStatusEvent.kt deleted file mode 100644 index c3b9b1e..0000000 --- a/notification-application/src/main/kotlin/gloddy/notification/dto/GroupStatusEvent.kt +++ /dev/null @@ -1,9 +0,0 @@ -package gloddy.notification.dto - -import gloddy.notification.UserId - -data class GroupStatusEvent( - val groupId: Long, - val groupMemberUserIds: List, - val eventType: GroupStatusEventType -) diff --git a/notification-application/src/main/kotlin/gloddy/notification/dto/GroupStatusEventType.kt b/notification-application/src/main/kotlin/gloddy/notification/dto/GroupStatusEventType.kt deleted file mode 100644 index b37a46c..0000000 --- a/notification-application/src/main/kotlin/gloddy/notification/dto/GroupStatusEventType.kt +++ /dev/null @@ -1,6 +0,0 @@ -package gloddy.notification.dto - -enum class GroupStatusEventType { - GROUP_APPROACHING_START, - GROUP_END -} \ No newline at end of file diff --git a/notification-application/src/main/kotlin/gloddy/notification/dto/event/ApplyEvent.kt b/notification-application/src/main/kotlin/gloddy/notification/dto/event/ApplyEvent.kt new file mode 100644 index 0000000..bdef879 --- /dev/null +++ b/notification-application/src/main/kotlin/gloddy/notification/dto/event/ApplyEvent.kt @@ -0,0 +1,11 @@ +package gloddy.notification.dto + +import gloddy.notification.dto.eventType.ApplyEventType +import gloddy.notification.UserId +import java.time.LocalDateTime + +data class ApplyEvent( + val userId: UserId, + val eventType: ApplyEventType, + val eventDateTime: LocalDateTime +) \ No newline at end of file diff --git a/notification-application/src/main/kotlin/gloddy/notification/dto/event/GroupArticleEvent.kt b/notification-application/src/main/kotlin/gloddy/notification/dto/event/GroupArticleEvent.kt new file mode 100644 index 0000000..8259c73 --- /dev/null +++ b/notification-application/src/main/kotlin/gloddy/notification/dto/event/GroupArticleEvent.kt @@ -0,0 +1,10 @@ +package gloddy.notification.dto + +import gloddy.notification.dto.eventType.GroupArticleEventType +import java.time.LocalDateTime + +data class GroupArticleEvent( + val articleId: Long, + val eventType: GroupArticleEventType, + val eventDateTime: LocalDateTime +) diff --git a/notification-application/src/main/kotlin/gloddy/notification/dto/event/GroupEvent.kt b/notification-application/src/main/kotlin/gloddy/notification/dto/event/GroupEvent.kt new file mode 100644 index 0000000..d4044d7 --- /dev/null +++ b/notification-application/src/main/kotlin/gloddy/notification/dto/event/GroupEvent.kt @@ -0,0 +1,12 @@ +package gloddy.notification.dto + +import gloddy.notification.dto.eventType.GroupMemberEventType +import gloddy.notification.UserId +import gloddy.notification.dto.eventType.GroupEventType +import java.time.LocalDateTime + +data class GroupEvent( + val groupId: Long, + val eventType: GroupEventType, + val eventDateTime: LocalDateTime +) \ No newline at end of file diff --git a/notification-application/src/main/kotlin/gloddy/notification/dto/event/GroupMemberEvent.kt b/notification-application/src/main/kotlin/gloddy/notification/dto/event/GroupMemberEvent.kt new file mode 100644 index 0000000..a79511f --- /dev/null +++ b/notification-application/src/main/kotlin/gloddy/notification/dto/event/GroupMemberEvent.kt @@ -0,0 +1,9 @@ +package gloddy.notification.dto + +import gloddy.notification.dto.eventType.GroupMemberEventType + +data class GroupMemberEvent( + val groupMemberId: Long, + val eventType: GroupMemberEventType, + val +) diff --git a/notification-domain/src/main/kotlin/gloddy/notification/ApplyEventType.kt b/notification-application/src/main/kotlin/gloddy/notification/dto/event/eventType/ApplyEventType.kt similarity index 66% rename from notification-domain/src/main/kotlin/gloddy/notification/ApplyEventType.kt rename to notification-application/src/main/kotlin/gloddy/notification/dto/event/eventType/ApplyEventType.kt index 86f1df1..e580e5b 100644 --- a/notification-domain/src/main/kotlin/gloddy/notification/ApplyEventType.kt +++ b/notification-application/src/main/kotlin/gloddy/notification/dto/event/eventType/ApplyEventType.kt @@ -1,4 +1,4 @@ -package gloddy.notification +package gloddy.notification.dto.eventType enum class ApplyEventType { APPLY_APPROVE, diff --git a/notification-application/src/main/kotlin/gloddy/notification/dto/GroupArticleEventType.kt b/notification-application/src/main/kotlin/gloddy/notification/dto/event/eventType/GroupArticleEventType.kt similarity index 59% rename from notification-application/src/main/kotlin/gloddy/notification/dto/GroupArticleEventType.kt rename to notification-application/src/main/kotlin/gloddy/notification/dto/event/eventType/GroupArticleEventType.kt index b990e5c..774273e 100644 --- a/notification-application/src/main/kotlin/gloddy/notification/dto/GroupArticleEventType.kt +++ b/notification-application/src/main/kotlin/gloddy/notification/dto/event/eventType/GroupArticleEventType.kt @@ -1,4 +1,4 @@ -package gloddy.notification.dto +package gloddy.notification.dto.eventType enum class GroupArticleEventType { GROUP_ARTICLE_CREATE diff --git a/notification-application/src/main/kotlin/gloddy/notification/dto/event/eventType/GroupEventType.kt b/notification-application/src/main/kotlin/gloddy/notification/dto/event/eventType/GroupEventType.kt new file mode 100644 index 0000000..4944f5c --- /dev/null +++ b/notification-application/src/main/kotlin/gloddy/notification/dto/event/eventType/GroupEventType.kt @@ -0,0 +1,6 @@ +package gloddy.notification.dto.eventType + +enum class GroupEventType { + GROUP_APPROACHING_START, + GROUP_END +} \ No newline at end of file diff --git a/notification-application/src/main/kotlin/gloddy/notification/dto/event/eventType/GroupMemberEventType.kt b/notification-application/src/main/kotlin/gloddy/notification/dto/event/eventType/GroupMemberEventType.kt new file mode 100644 index 0000000..244bd05 --- /dev/null +++ b/notification-application/src/main/kotlin/gloddy/notification/dto/event/eventType/GroupMemberEventType.kt @@ -0,0 +1,5 @@ +package gloddy.notification.dto.eventType + +enum class GroupMemberEventType { + GROUP_LEAVE +} \ No newline at end of file diff --git a/notification-application/src/main/kotlin/gloddy/notification/dto/payload/ApplyPayload.kt b/notification-application/src/main/kotlin/gloddy/notification/dto/payload/ApplyPayload.kt new file mode 100644 index 0000000..cb3b567 --- /dev/null +++ b/notification-application/src/main/kotlin/gloddy/notification/dto/payload/ApplyPayload.kt @@ -0,0 +1,8 @@ +package gloddy.notification.dto.payload + +data class ApplyPayload ( + val groupId: Long, + val captainId: Long, + val applyUserId: Long, + val groupImage: String +) \ No newline at end of file diff --git a/notification-application/src/main/kotlin/gloddy/notification/dto/payload/GroupArticlePayload.kt b/notification-application/src/main/kotlin/gloddy/notification/dto/payload/GroupArticlePayload.kt new file mode 100644 index 0000000..47da35e --- /dev/null +++ b/notification-application/src/main/kotlin/gloddy/notification/dto/payload/GroupArticlePayload.kt @@ -0,0 +1,11 @@ +package gloddy.notification.dto.payload + +data class GroupArticlePayload( + val groupId: Long, + val captainId: Long, + val writerId: Long, + val groupImage: String, + val groupMemberIds: GroupMemberIds +) + + diff --git a/notification-application/src/main/kotlin/gloddy/notification/dto/payload/GroupMemberIds.kt b/notification-application/src/main/kotlin/gloddy/notification/dto/payload/GroupMemberIds.kt new file mode 100644 index 0000000..6e97c93 --- /dev/null +++ b/notification-application/src/main/kotlin/gloddy/notification/dto/payload/GroupMemberIds.kt @@ -0,0 +1,4 @@ +package gloddy.notification.dto.payload + +@JvmInline +value class GroupMemberIds(val value: List) \ No newline at end of file diff --git a/notification-application/src/main/kotlin/gloddy/notification/dto/payload/GroupMemberPayload.kt b/notification-application/src/main/kotlin/gloddy/notification/dto/payload/GroupMemberPayload.kt new file mode 100644 index 0000000..b459724 --- /dev/null +++ b/notification-application/src/main/kotlin/gloddy/notification/dto/payload/GroupMemberPayload.kt @@ -0,0 +1,8 @@ +package gloddy.notification.dto.payload + +data class GroupMemberPayload ( + val groupId: Long, + val captainId: Long, + val groupMemberName: String, + val groupImage: Long +) \ No newline at end of file diff --git a/notification-application/src/main/kotlin/gloddy/notification/dto/payload/GroupPayload.kt b/notification-application/src/main/kotlin/gloddy/notification/dto/payload/GroupPayload.kt new file mode 100644 index 0000000..fe96bb1 --- /dev/null +++ b/notification-application/src/main/kotlin/gloddy/notification/dto/payload/GroupPayload.kt @@ -0,0 +1,8 @@ +package gloddy.notification.dto.payload + +data class GroupPayload( + val groupId: Long, + val captainId: Long, + val groupImage: String, + val groupMemberIds: GroupMemberIds +) \ No newline at end of file diff --git a/notification-domain/src/main/kotlin/gloddy/notification/GroupEventType.kt b/notification-domain/src/main/kotlin/gloddy/notification/GroupEventType.kt deleted file mode 100644 index 91d68fc..0000000 --- a/notification-domain/src/main/kotlin/gloddy/notification/GroupEventType.kt +++ /dev/null @@ -1,5 +0,0 @@ -package gloddy.notification - -enum class GroupEventType { - GROUP_LEAVE -} \ No newline at end of file diff --git a/out-internal-api/src/main/kotlin/gloddy/openFeign/OpenFeignConfig.kt b/out-internal-api/src/main/kotlin/gloddy/openFeign/config/OpenFeignConfig.kt similarity index 100% rename from out-internal-api/src/main/kotlin/gloddy/openFeign/OpenFeignConfig.kt rename to out-internal-api/src/main/kotlin/gloddy/openFeign/config/OpenFeignConfig.kt diff --git a/out-internal-api/src/main/resources/application.yml b/out-internal-api/src/main/resources/application-internal.yml similarity index 100% rename from out-internal-api/src/main/resources/application.yml rename to out-internal-api/src/main/resources/application-internal.yml From b17bae3aed6ba1e6d4b1b93ec5789a63adb77cd8 Mon Sep 17 00:00:00 2001 From: twoosky Date: Wed, 6 Dec 2023 06:24:16 +0900 Subject: [PATCH 15/35] =?UTF-8?q?feat:=20applyPayload=20=EC=A1=B0=ED=9A=8C?= =?UTF-8?q?=20outputPort=20=EC=A0=95=EC=9D=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gloddy/notification/port/out/ApplyPayloadGetPort.kt | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 notification-application/src/main/kotlin/gloddy/notification/port/out/ApplyPayloadGetPort.kt diff --git a/notification-application/src/main/kotlin/gloddy/notification/port/out/ApplyPayloadGetPort.kt b/notification-application/src/main/kotlin/gloddy/notification/port/out/ApplyPayloadGetPort.kt new file mode 100644 index 0000000..2857dae --- /dev/null +++ b/notification-application/src/main/kotlin/gloddy/notification/port/out/ApplyPayloadGetPort.kt @@ -0,0 +1,8 @@ +package gloddy.notification.port.out + +import gloddy.notification.dto.event.eventType.ApplyEventType +import gloddy.notification.dto.payload.ApplyPayload + +interface ApplyPayloadGetPort { + fun getApplyPayload(applyId: Long, eventType: ApplyEventType): ApplyPayload +} \ No newline at end of file From 27d48d08ce26240022d169a506363fdad303cc5d Mon Sep 17 00:00:00 2001 From: twoosky Date: Wed, 6 Dec 2023 06:25:37 +0900 Subject: [PATCH 16/35] =?UTF-8?q?refactor:=20zero=20payload=20=EB=B0=A9?= =?UTF-8?q?=EC=8B=9D=EC=9C=BC=EB=A1=9C=20=EC=9D=B4=EB=B2=A4=ED=8A=B8=20dto?= =?UTF-8?q?=20=EB=A6=AC=ED=8C=A9=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kotlin/gloddy/notification/dto/event/ApplyEvent.kt | 9 ++++----- .../gloddy/notification/dto/event/GroupArticleEvent.kt | 4 ++-- .../kotlin/gloddy/notification/dto/event/GroupEvent.kt | 6 ++---- .../gloddy/notification/dto/event/GroupMemberEvent.kt | 7 ++++--- .../notification/dto/event/eventType/ApplyEventType.kt | 2 +- .../dto/event/eventType/GroupArticleEventType.kt | 2 +- .../notification/dto/event/eventType/GroupEventType.kt | 2 +- .../dto/event/eventType/GroupMemberEventType.kt | 2 +- 8 files changed, 16 insertions(+), 18 deletions(-) diff --git a/notification-application/src/main/kotlin/gloddy/notification/dto/event/ApplyEvent.kt b/notification-application/src/main/kotlin/gloddy/notification/dto/event/ApplyEvent.kt index bdef879..fc85d8f 100644 --- a/notification-application/src/main/kotlin/gloddy/notification/dto/event/ApplyEvent.kt +++ b/notification-application/src/main/kotlin/gloddy/notification/dto/event/ApplyEvent.kt @@ -1,11 +1,10 @@ -package gloddy.notification.dto +package gloddy.notification.dto.event -import gloddy.notification.dto.eventType.ApplyEventType -import gloddy.notification.UserId +import gloddy.notification.dto.event.eventType.ApplyEventType import java.time.LocalDateTime -data class ApplyEvent( - val userId: UserId, +data class ApplyEvent ( + val applyId: Long, val eventType: ApplyEventType, val eventDateTime: LocalDateTime ) \ No newline at end of file diff --git a/notification-application/src/main/kotlin/gloddy/notification/dto/event/GroupArticleEvent.kt b/notification-application/src/main/kotlin/gloddy/notification/dto/event/GroupArticleEvent.kt index 8259c73..5fb4344 100644 --- a/notification-application/src/main/kotlin/gloddy/notification/dto/event/GroupArticleEvent.kt +++ b/notification-application/src/main/kotlin/gloddy/notification/dto/event/GroupArticleEvent.kt @@ -1,6 +1,6 @@ -package gloddy.notification.dto +package gloddy.notification.dto.event -import gloddy.notification.dto.eventType.GroupArticleEventType +import gloddy.notification.dto.event.eventType.GroupArticleEventType import java.time.LocalDateTime data class GroupArticleEvent( diff --git a/notification-application/src/main/kotlin/gloddy/notification/dto/event/GroupEvent.kt b/notification-application/src/main/kotlin/gloddy/notification/dto/event/GroupEvent.kt index d4044d7..b4ff3b7 100644 --- a/notification-application/src/main/kotlin/gloddy/notification/dto/event/GroupEvent.kt +++ b/notification-application/src/main/kotlin/gloddy/notification/dto/event/GroupEvent.kt @@ -1,8 +1,6 @@ -package gloddy.notification.dto +package gloddy.notification.dto.event -import gloddy.notification.dto.eventType.GroupMemberEventType -import gloddy.notification.UserId -import gloddy.notification.dto.eventType.GroupEventType +import gloddy.notification.dto.event.eventType.GroupEventType import java.time.LocalDateTime data class GroupEvent( diff --git a/notification-application/src/main/kotlin/gloddy/notification/dto/event/GroupMemberEvent.kt b/notification-application/src/main/kotlin/gloddy/notification/dto/event/GroupMemberEvent.kt index a79511f..63277b3 100644 --- a/notification-application/src/main/kotlin/gloddy/notification/dto/event/GroupMemberEvent.kt +++ b/notification-application/src/main/kotlin/gloddy/notification/dto/event/GroupMemberEvent.kt @@ -1,9 +1,10 @@ -package gloddy.notification.dto +package gloddy.notification.dto.event -import gloddy.notification.dto.eventType.GroupMemberEventType +import gloddy.notification.dto.event.eventType.GroupMemberEventType +import java.time.LocalDateTime data class GroupMemberEvent( val groupMemberId: Long, val eventType: GroupMemberEventType, - val + val eventDateTime: LocalDateTime ) diff --git a/notification-application/src/main/kotlin/gloddy/notification/dto/event/eventType/ApplyEventType.kt b/notification-application/src/main/kotlin/gloddy/notification/dto/event/eventType/ApplyEventType.kt index e580e5b..32ecfc9 100644 --- a/notification-application/src/main/kotlin/gloddy/notification/dto/event/eventType/ApplyEventType.kt +++ b/notification-application/src/main/kotlin/gloddy/notification/dto/event/eventType/ApplyEventType.kt @@ -1,4 +1,4 @@ -package gloddy.notification.dto.eventType +package gloddy.notification.dto.event.eventType enum class ApplyEventType { APPLY_APPROVE, diff --git a/notification-application/src/main/kotlin/gloddy/notification/dto/event/eventType/GroupArticleEventType.kt b/notification-application/src/main/kotlin/gloddy/notification/dto/event/eventType/GroupArticleEventType.kt index 774273e..e303088 100644 --- a/notification-application/src/main/kotlin/gloddy/notification/dto/event/eventType/GroupArticleEventType.kt +++ b/notification-application/src/main/kotlin/gloddy/notification/dto/event/eventType/GroupArticleEventType.kt @@ -1,4 +1,4 @@ -package gloddy.notification.dto.eventType +package gloddy.notification.dto.event.eventType enum class GroupArticleEventType { GROUP_ARTICLE_CREATE diff --git a/notification-application/src/main/kotlin/gloddy/notification/dto/event/eventType/GroupEventType.kt b/notification-application/src/main/kotlin/gloddy/notification/dto/event/eventType/GroupEventType.kt index 4944f5c..0bedf34 100644 --- a/notification-application/src/main/kotlin/gloddy/notification/dto/event/eventType/GroupEventType.kt +++ b/notification-application/src/main/kotlin/gloddy/notification/dto/event/eventType/GroupEventType.kt @@ -1,4 +1,4 @@ -package gloddy.notification.dto.eventType +package gloddy.notification.dto.event.eventType enum class GroupEventType { GROUP_APPROACHING_START, diff --git a/notification-application/src/main/kotlin/gloddy/notification/dto/event/eventType/GroupMemberEventType.kt b/notification-application/src/main/kotlin/gloddy/notification/dto/event/eventType/GroupMemberEventType.kt index 244bd05..058e33e 100644 --- a/notification-application/src/main/kotlin/gloddy/notification/dto/event/eventType/GroupMemberEventType.kt +++ b/notification-application/src/main/kotlin/gloddy/notification/dto/event/eventType/GroupMemberEventType.kt @@ -1,4 +1,4 @@ -package gloddy.notification.dto.eventType +package gloddy.notification.dto.event.eventType enum class GroupMemberEventType { GROUP_LEAVE From bfe2cab0772d1070265681482e880069a78431d0 Mon Sep 17 00:00:00 2001 From: twoosky Date: Wed, 6 Dec 2023 06:25:57 +0900 Subject: [PATCH 17/35] =?UTF-8?q?fix:=20in=20port=20=ED=8C=8C=EB=9D=BC?= =?UTF-8?q?=EB=AF=B8=ED=84=B0=EB=AA=85=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../port/in/ApplyNotificationCreateUseCase.kt | 4 ++-- .../port/in/GroupNotificationCreateUseCase.kt | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/notification-application/src/main/kotlin/gloddy/notification/port/in/ApplyNotificationCreateUseCase.kt b/notification-application/src/main/kotlin/gloddy/notification/port/in/ApplyNotificationCreateUseCase.kt index c41575e..d1c6b24 100644 --- a/notification-application/src/main/kotlin/gloddy/notification/port/in/ApplyNotificationCreateUseCase.kt +++ b/notification-application/src/main/kotlin/gloddy/notification/port/in/ApplyNotificationCreateUseCase.kt @@ -1,7 +1,7 @@ package gloddy.notification.port.`in` -import gloddy.notification.dto.ApplyEvent +import gloddy.notification.dto.event.ApplyEvent interface ApplyNotificationCreateUseCase { - fun create(applyEvent: ApplyEvent) + fun create(event: ApplyEvent) } \ No newline at end of file diff --git a/notification-application/src/main/kotlin/gloddy/notification/port/in/GroupNotificationCreateUseCase.kt b/notification-application/src/main/kotlin/gloddy/notification/port/in/GroupNotificationCreateUseCase.kt index 8a16e1c..91cebfd 100644 --- a/notification-application/src/main/kotlin/gloddy/notification/port/in/GroupNotificationCreateUseCase.kt +++ b/notification-application/src/main/kotlin/gloddy/notification/port/in/GroupNotificationCreateUseCase.kt @@ -1,11 +1,11 @@ package gloddy.notification.port.`in` -import gloddy.notification.dto.GroupArticleEvent -import gloddy.notification.dto.GroupEvent -import gloddy.notification.dto.GroupStatusEvent +import gloddy.notification.dto.event.GroupArticleEvent +import gloddy.notification.dto.event.GroupEvent +import gloddy.notification.dto.event.GroupMemberEvent interface GroupNotificationCreateUseCase { - fun create(groupEvent: GroupEvent) - fun create(groupStatusEvent: GroupStatusEvent) - fun create(groupArticleEvent: GroupArticleEvent) + fun create(event: GroupEvent) + fun create(event: GroupMemberEvent) + fun create(event: GroupArticleEvent) } \ No newline at end of file From f9303db4ebe2e3946a9b5e8819fcc90b861e8d39 Mon Sep 17 00:00:00 2001 From: twoosky Date: Wed, 6 Dec 2023 06:26:11 +0900 Subject: [PATCH 18/35] =?UTF-8?q?feat:=20group=20payload=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=20outputPort=20=EC=A0=95=EC=9D=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../notification/port/out/GroupPayloadGetPort.kt | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/notification-application/src/main/kotlin/gloddy/notification/port/out/GroupPayloadGetPort.kt b/notification-application/src/main/kotlin/gloddy/notification/port/out/GroupPayloadGetPort.kt index 7f85060..c069200 100644 --- a/notification-application/src/main/kotlin/gloddy/notification/port/out/GroupPayloadGetPort.kt +++ b/notification-application/src/main/kotlin/gloddy/notification/port/out/GroupPayloadGetPort.kt @@ -1,8 +1,14 @@ package gloddy.notification.port.out -import gloddy.notification.UserId -import gloddy.notification.dto.GroupPayloadDto +import gloddy.notification.dto.event.eventType.GroupArticleEventType +import gloddy.notification.dto.event.eventType.GroupEventType +import gloddy.notification.dto.event.eventType.GroupMemberEventType +import gloddy.notification.dto.payload.GroupArticlePayload +import gloddy.notification.dto.payload.GroupMemberPayload +import gloddy.notification.dto.payload.GroupPayload interface GroupPayloadGetPort { - fun get(userId: UserId): GroupPayloadDto + fun getGroupPayload(groupId: Long, eventType: GroupEventType): GroupPayload + fun getGroupArticlePayload(articleId: Long, eventType: GroupArticleEventType): GroupArticlePayload + fun getGroupMemberPayload(groupMemberId: Long, eventType: GroupMemberEventType): GroupMemberPayload } \ No newline at end of file From 2fb7781740035db74c84e646fbfb8ca5a6a6dfdf Mon Sep 17 00:00:00 2001 From: twoosky Date: Wed, 6 Dec 2023 06:28:49 +0900 Subject: [PATCH 19/35] =?UTF-8?q?feat:=20apply=20=EC=9D=B4=EB=B2=A4?= =?UTF-8?q?=ED=8A=B8=EC=97=90=20=EB=8C=80=ED=95=9C=20=EC=95=8C=EB=A6=BC=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1=20=EC=84=9C=EB=B9=84=EC=8A=A4=EC=97=90=20pay?= =?UTF-8?q?load=20=EC=9A=94=EC=B2=AD=20=EB=A1=9C=EC=A7=81=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/ApplyNotificationCreateService.kt | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/notification-application/src/main/kotlin/gloddy/notification/service/ApplyNotificationCreateService.kt b/notification-application/src/main/kotlin/gloddy/notification/service/ApplyNotificationCreateService.kt index c2c814d..a73d7a1 100644 --- a/notification-application/src/main/kotlin/gloddy/notification/service/ApplyNotificationCreateService.kt +++ b/notification-application/src/main/kotlin/gloddy/notification/service/ApplyNotificationCreateService.kt @@ -2,38 +2,42 @@ package gloddy.notification.service import gloddy.notification.* import gloddy.notification.NotificationType.APPLY_CREATE -import gloddy.notification.dto.ApplyEvent +import gloddy.notification.dto.event.ApplyEvent +import gloddy.notification.dto.payload.ApplyPayload import gloddy.notification.event.NotificationEventPublisher import gloddy.notification.event.toNotificationCreateEvent import gloddy.notification.port.`in`.ApplyNotificationCreateUseCase +import gloddy.notification.port.out.ApplyPayloadGetPort import gloddy.notification.port.out.NotificationCreatePort import org.springframework.stereotype.Service @Service class ApplyNotificationCreateService( private val notificationCreatePort: NotificationCreatePort, - private val notificationEventPublisher: NotificationEventPublisher + private val applyPayloadGetPort: ApplyPayloadGetPort, + private val notificationEventPublisher: NotificationEventPublisher, ): ApplyNotificationCreateUseCase { - override fun create(applyEvent: ApplyEvent) { - val type = NotificationType.of(applyEvent.eventType.name) + override fun create(event: ApplyEvent) { + val payload = applyPayloadGetPort.getApplyPayload(event.applyId, event.eventType) + val notificationType = NotificationType.of(event.eventType.name) Notification( - redirectId = applyEvent.applyGroupId, - userId = getTargetUserId(type, applyEvent), - title = type.title, - content = type.content, - type = type + userId = getTargetUserId(notificationType, payload), + redirectId = RedirectId(payload.groupId), + title = notificationType.title(null), + content = notificationType.content, + type = notificationType ).run { notificationCreatePort.save(this) notificationEventPublisher.publishEvent(this.toNotificationCreateEvent()) } } - private fun getTargetUserId(type: NotificationType, applyEvent: ApplyEvent): UserId { + private fun getTargetUserId(type: NotificationType, payload: ApplyPayload): UserId { return when(type) { - in listOf(APPLY_CREATE) -> applyEvent.userId - else -> applyEvent.applyUserId - } + in listOf(APPLY_CREATE) -> payload.captainId + else -> payload.applyUserId + }.run { UserId(this) } } } \ No newline at end of file From fef6098e2c3eacf09de30f532a87b18d72ec900d Mon Sep 17 00:00:00 2001 From: twoosky Date: Wed, 6 Dec 2023 06:29:05 +0900 Subject: [PATCH 20/35] =?UTF-8?q?feat:=20group=20=EC=9D=B4=EB=B2=A4?= =?UTF-8?q?=ED=8A=B8=EC=97=90=20=EB=8C=80=ED=95=9C=20=EC=95=8C=EB=A6=BC=20?= =?UTF-8?q?=EC=84=9C=EB=B9=84=EC=8A=A4=EC=97=90=20payload=20=EC=9A=94?= =?UTF-8?q?=EC=B2=AD=20=EB=A1=9C=EC=A7=81=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/GroupNotificationCreateService.kt | 77 ++++++++++--------- 1 file changed, 40 insertions(+), 37 deletions(-) diff --git a/notification-application/src/main/kotlin/gloddy/notification/service/GroupNotificationCreateService.kt b/notification-application/src/main/kotlin/gloddy/notification/service/GroupNotificationCreateService.kt index 7857915..97c9e77 100644 --- a/notification-application/src/main/kotlin/gloddy/notification/service/GroupNotificationCreateService.kt +++ b/notification-application/src/main/kotlin/gloddy/notification/service/GroupNotificationCreateService.kt @@ -1,12 +1,13 @@ package gloddy.notification.service import gloddy.notification.* -import gloddy.notification.dto.GroupArticleEvent -import gloddy.notification.dto.GroupEvent -import gloddy.notification.dto.GroupStatusEvent +import gloddy.notification.dto.event.GroupArticleEvent +import gloddy.notification.dto.event.GroupEvent +import gloddy.notification.dto.event.GroupMemberEvent import gloddy.notification.event.NotificationEventPublisher import gloddy.notification.event.toNotificationCreateEvent import gloddy.notification.port.`in`.GroupNotificationCreateUseCase +import gloddy.notification.port.out.GroupPayloadGetPort import gloddy.notification.port.out.NotificationCreatePort import org.springframework.stereotype.Service @@ -14,34 +15,18 @@ import org.springframework.stereotype.Service class GroupNotificationCreateService( private val notificationCreatePort: NotificationCreatePort, private val notificationEventPublisher: NotificationEventPublisher, -// private val groupPayloadGetPort: GroupPayloadGetPort, + private val groupPayloadGetPort: GroupPayloadGetPort, ): GroupNotificationCreateUseCase { - override fun create(groupEvent: GroupEvent) { -// val payload = groupPayloadGetPort.get(groupEvent.userId) - - val notificationType = NotificationType.of(groupEvent.eventType.name) - - Notification( - redirectId = groupEvent.groupId, - userId = groupEvent.userId, - title = notificationType.title, - content = notificationType.getContent(), - type = notificationType - ).run { - notificationCreatePort.save(this) - notificationEventPublisher.publishEvent(this.toNotificationCreateEvent()) - } - } - - override fun create(event: GroupStatusEvent) { + override fun create(event: GroupEvent) { + val payload = groupPayloadGetPort.getGroupPayload(event.groupId, event.eventType) val notificationType = NotificationType.of(event.eventType.name) - event.groupMemberUserIds.forEach { + payload.groupMemberIds.value.forEach { Notification( - userId = it, - redirectId = event.groupId, - title = notificationType.title, + userId = UserId(it), + redirectId = RedirectId(payload.groupId), + title = notificationType.title(null), content = notificationType.content, type = notificationType ).run { @@ -51,20 +36,38 @@ class GroupNotificationCreateService( } } + override fun create(event: GroupMemberEvent) { + val payload = groupPayloadGetPort.getGroupMemberPayload(event.groupMemberId, event.eventType) + val notificationType = NotificationType.of(event.eventType.name) + + Notification( + userId = UserId(payload.captainId), + redirectId = RedirectId(payload.groupId), + title = notificationType.title(payload.groupMemberName), + content = notificationType.content, + type = notificationType + ).run { + notificationCreatePort.save(this) + notificationEventPublisher.publishEvent(this.toNotificationCreateEvent()) + } + } + override fun create(event: GroupArticleEvent) { + val payload = groupPayloadGetPort.getGroupArticlePayload(event.articleId, event.eventType) val notificationType = NotificationType.of(event.eventType.name) - event.groupMemberUserIds.forEach { - Notification( - userId = it, - redirectId = event.groupId, - title = notificationType.title, - content = notificationType.content, - type = notificationType - ).run { - notificationCreatePort.save(this) - notificationEventPublisher.publishEvent(this.toNotificationCreateEvent()) + payload.groupMemberIds.value.filter { it != payload.writerId } + .forEach { + Notification( + userId = UserId(it), + redirectId = RedirectId(payload.groupId), + title = notificationType.title(null), + content = notificationType.content, + type = notificationType + ).run { + notificationCreatePort.save(this) + notificationEventPublisher.publishEvent(this.toNotificationCreateEvent()) + } } - } } } \ No newline at end of file From e3ab74e4ce7ddc7afa0a6da89d73f58a13e94cd3 Mon Sep 17 00:00:00 2001 From: twoosky Date: Wed, 6 Dec 2023 06:31:37 +0900 Subject: [PATCH 21/35] =?UTF-8?q?feat:=20=EA=B7=B8=EB=A3=B9=20=EC=8B=9C?= =?UTF-8?q?=EC=8A=A4=ED=85=9C=EC=9C=BC=EB=A1=9C=20payload=20=EC=9A=94?= =?UTF-8?q?=EC=B2=AD=EC=9D=84=20=EC=9C=84=ED=95=9C=20OpenFeign=20client=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../openFeign/client/ApplyPayloadGetClient.kt | 19 ++++++++++ .../openFeign/client/GroupPayloadGetClient.kt | 35 +++++++++++++++++++ .../openFeign/config/OpenFeignConfig.kt | 2 +- 3 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 out-internal-api/src/main/kotlin/gloddy/openFeign/client/ApplyPayloadGetClient.kt create mode 100644 out-internal-api/src/main/kotlin/gloddy/openFeign/client/GroupPayloadGetClient.kt diff --git a/out-internal-api/src/main/kotlin/gloddy/openFeign/client/ApplyPayloadGetClient.kt b/out-internal-api/src/main/kotlin/gloddy/openFeign/client/ApplyPayloadGetClient.kt new file mode 100644 index 0000000..ac92f06 --- /dev/null +++ b/out-internal-api/src/main/kotlin/gloddy/openFeign/client/ApplyPayloadGetClient.kt @@ -0,0 +1,19 @@ +package gloddy.openFeign.client + +import gloddy.notification.dto.event.eventType.ApplyEventType +import gloddy.notification.dto.payload.ApplyPayload +import gloddy.notification.port.out.ApplyPayloadGetPort +import org.springframework.cloud.openfeign.FeignClient +import org.springframework.web.bind.annotation.GetMapping +import org.springframework.web.bind.annotation.PathVariable +import org.springframework.web.bind.annotation.RequestParam + +@FeignClient(name = "ApplyPayloadGetClient", url = "\${internal.api.base-url}") +interface ApplyPayloadGetClient : ApplyPayloadGetPort { + + @GetMapping("/applies/{applyId}") + override fun getApplyPayload( + @PathVariable("applyId") applyId: Long, + @RequestParam("eventType") eventType: ApplyEventType + ): ApplyPayload +} \ No newline at end of file diff --git a/out-internal-api/src/main/kotlin/gloddy/openFeign/client/GroupPayloadGetClient.kt b/out-internal-api/src/main/kotlin/gloddy/openFeign/client/GroupPayloadGetClient.kt new file mode 100644 index 0000000..fa6878f --- /dev/null +++ b/out-internal-api/src/main/kotlin/gloddy/openFeign/client/GroupPayloadGetClient.kt @@ -0,0 +1,35 @@ +package gloddy.openFeign.client + +import gloddy.notification.dto.event.eventType.GroupArticleEventType +import gloddy.notification.dto.event.eventType.GroupEventType +import gloddy.notification.dto.event.eventType.GroupMemberEventType +import gloddy.notification.dto.payload.GroupArticlePayload +import gloddy.notification.dto.payload.GroupMemberPayload +import gloddy.notification.dto.payload.GroupPayload +import gloddy.notification.port.out.GroupPayloadGetPort +import org.springframework.cloud.openfeign.FeignClient +import org.springframework.web.bind.annotation.GetMapping +import org.springframework.web.bind.annotation.PathVariable +import org.springframework.web.bind.annotation.RequestParam + +@FeignClient(name = "GroupPayloadGetClient", url = "\${internal.api.base-url}") +interface GroupPayloadGetClient : GroupPayloadGetPort { + + @GetMapping("/groups/{groupId}") + override fun getGroupPayload( + @PathVariable("groupId") groupId: Long, + @RequestParam("eventType") eventType: GroupEventType + ): GroupPayload + + @GetMapping("/groups/articles/{articleId}") + override fun getGroupArticlePayload( + @PathVariable("articleId") articleId: Long, + @RequestParam("eventType") eventType: GroupArticleEventType + ): GroupArticlePayload + + @GetMapping("/groups/members/{groupMemberId}") + override fun getGroupMemberPayload( + @PathVariable("groupMemberId") groupMemberId: Long, + @RequestParam("eventType") eventType: GroupMemberEventType + ): GroupMemberPayload +} \ No newline at end of file diff --git a/out-internal-api/src/main/kotlin/gloddy/openFeign/config/OpenFeignConfig.kt b/out-internal-api/src/main/kotlin/gloddy/openFeign/config/OpenFeignConfig.kt index a094f5a..4538a58 100644 --- a/out-internal-api/src/main/kotlin/gloddy/openFeign/config/OpenFeignConfig.kt +++ b/out-internal-api/src/main/kotlin/gloddy/openFeign/config/OpenFeignConfig.kt @@ -1,4 +1,4 @@ -package gloddy.openFeign +package gloddy.openFeign.config import feign.Logger import org.springframework.cloud.openfeign.EnableFeignClients From 49bc26fac30a06ea906e6638151b412afdfdd6f7 Mon Sep 17 00:00:00 2001 From: twoosky Date: Wed, 6 Dec 2023 06:31:57 +0900 Subject: [PATCH 22/35] =?UTF-8?q?feat:=20=EA=B7=B8=EB=A3=B9=20=EC=8B=9C?= =?UTF-8?q?=EC=8A=A4=ED=85=9C=20base=20url=20=ED=99=98=EA=B2=BD=EB=B3=80?= =?UTF-8?q?=EC=88=98=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- out-internal-api/src/main/resources/application-internal.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/out-internal-api/src/main/resources/application-internal.yml b/out-internal-api/src/main/resources/application-internal.yml index 8b13789..00a3bde 100644 --- a/out-internal-api/src/main/resources/application-internal.yml +++ b/out-internal-api/src/main/resources/application-internal.yml @@ -1 +1,5 @@ +internal: + api: + base-url: ${INTERNAL_API_BASE_URL} + From 86111215b530870d6e1243c8146f254b694b987a Mon Sep 17 00:00:00 2001 From: twoosky Date: Wed, 6 Dec 2023 06:32:26 +0900 Subject: [PATCH 23/35] =?UTF-8?q?chore:=20internal-api=20=EB=AA=A8?= =?UTF-8?q?=EB=93=88=EC=97=90=20domain,=20application=20=EB=AA=A8=EB=93=88?= =?UTF-8?q?=20=EC=9D=98=EC=A1=B4=EC=84=B1=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- out-internal-api/build.gradle.kts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/out-internal-api/build.gradle.kts b/out-internal-api/build.gradle.kts index 0fe9335..3af61f8 100644 --- a/out-internal-api/build.gradle.kts +++ b/out-internal-api/build.gradle.kts @@ -9,6 +9,9 @@ jar.enabled = true extra["springCloudVersion"] = "2022.0.4" dependencies { + implementation(project(":notification-application")) + implementation(project(":notification-domain")) + implementation("org.springframework.cloud:spring-cloud-starter-openfeign") testImplementation("org.springframework.boot:spring-boot-starter-test") } From cd50c18179a26f5685661c8afc8fe2ec7ffc32ef Mon Sep 17 00:00:00 2001 From: twoosky Date: Wed, 6 Dec 2023 06:33:04 +0900 Subject: [PATCH 24/35] =?UTF-8?q?feat:=20redirectId=EC=97=90=20=EB=8C=80?= =?UTF-8?q?=ED=95=9C=20value=20=EA=B0=9D=EC=B2=B4=20=EC=A0=95=EC=9D=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/kotlin/gloddy/notification/Notification.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/notification-domain/src/main/kotlin/gloddy/notification/Notification.kt b/notification-domain/src/main/kotlin/gloddy/notification/Notification.kt index 02059fc..f287721 100644 --- a/notification-domain/src/main/kotlin/gloddy/notification/Notification.kt +++ b/notification-domain/src/main/kotlin/gloddy/notification/Notification.kt @@ -6,13 +6,16 @@ import java.util.* @JvmInline value class UserId(val value: Long) +@JvmInline +value class RedirectId(val value: Long) + @JvmInline value class NotificationId(val value: String) data class Notification( val id: NotificationId = NotificationId(UUID.randomUUID().toString()), val userId: UserId, - val redirectId: Long, + val redirectId: RedirectId, val title: String, val content: String, val type: NotificationType From 1d665667b919b2816730fed36a1bf2ec85af2aa4 Mon Sep 17 00:00:00 2001 From: twoosky Date: Wed, 6 Dec 2023 06:33:27 +0900 Subject: [PATCH 25/35] =?UTF-8?q?fix:=20=EC=95=8C=EB=A6=BC=20title=20?= =?UTF-8?q?=EB=9E=8C=EB=8B=A4=EC=8B=9D=EC=9C=BC=EB=A1=9C=20=EC=84=A0?= =?UTF-8?q?=EC=96=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gloddy/notification/NotificationType.kt | 29 +++++++------------ 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/notification-domain/src/main/kotlin/gloddy/notification/NotificationType.kt b/notification-domain/src/main/kotlin/gloddy/notification/NotificationType.kt index 9a0a24e..ac40b07 100644 --- a/notification-domain/src/main/kotlin/gloddy/notification/NotificationType.kt +++ b/notification-domain/src/main/kotlin/gloddy/notification/NotificationType.kt @@ -1,51 +1,42 @@ package gloddy.notification enum class NotificationType( - val title: String, + val title: (String?) -> String, val content: String ) { APPLY_APPROVE( - "👌Your applied gathering has been approved!", + { "👌Your applied gathering has been approved!" }, "Wishing you enjoy a fun and safe gathering." ), APPLY_REFUSE( - "😢The gathering you applied for has been declined.", + { "😢The gathering you applied for has been declined." }, "There are various other gatherings available for you! Would you like to look for another gathering?" ), APPLY_CREATE( - "💌A new gathering application has arrived!", + { "💌A new gathering application has arrived!" }, "We’re awaiting the host’s approval for the gathering! please warmly welcome the new members." ), GROUP_LEAVE( - "😢has just left the group.", + { value: String? -> "😢$value has just left the group." }, "Shall we go check the group participants?" ), GROUP_ARTICLE_CREATE( - "🗣️Please Check the New Notice!", + { "🗣️Please Check the New Notice!" }, "A new post has been added." ), GROUP_APPROACHING_START( - "⏰The gathering starts in 1 hour!", + { "⏰The gathering starts in 1 hour!" }, "Are you ready to enjoy the gathering? \n" + "Check the announcement for a better gathering!" ), GROUP_END( - "😆Did you enjoy the gathering?", + { "😆Did you enjoy the gathering?" }, "Please rate the attendees of the gathering! \n" + "Select the best partner with reward stickers." ) ; - companion object { - fun of(type: String): NotificationType { - return values().firstOrNull { it.name == type } + fun of(type: String): NotificationType = + values().firstOrNull { it.name == type } ?: throw RuntimeException("존재하지 않는 Notification 유형 입니다.") - } - } - - fun getContent(name: String = "member"): String { - return when(this) { - in listOf(GROUP_LEAVE) -> "${name} ${content}" - else -> content - } } } \ No newline at end of file From c1fc6219b8a2ad9febd06690933ce8183692c351 Mon Sep 17 00:00:00 2001 From: twoosky Date: Wed, 6 Dec 2023 06:33:49 +0900 Subject: [PATCH 26/35] =?UTF-8?q?fix:=20redirectId=20value=20=EA=B0=9D?= =?UTF-8?q?=EC=B2=B4=EB=A1=9C=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gloddy/dynamodb/notification/NotificationMapper.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/notification-out-adapter-persistence/src/main/kotlin/gloddy/dynamodb/notification/NotificationMapper.kt b/notification-out-adapter-persistence/src/main/kotlin/gloddy/dynamodb/notification/NotificationMapper.kt index a07cdf2..5bc58c7 100644 --- a/notification-out-adapter-persistence/src/main/kotlin/gloddy/dynamodb/notification/NotificationMapper.kt +++ b/notification-out-adapter-persistence/src/main/kotlin/gloddy/dynamodb/notification/NotificationMapper.kt @@ -2,6 +2,7 @@ package gloddy.dynamodb.notification import gloddy.notification.Notification import gloddy.notification.NotificationId +import gloddy.notification.RedirectId import gloddy.notification.UserId @@ -9,7 +10,7 @@ fun NotificationEntity.toDomain(): Notification = Notification( id = NotificationId(this.id), userId = UserId(this.userId.toLong()), - redirectId = this.redirectId.toLong(), + redirectId = RedirectId(this.redirectId.toLong()), title = this.title, content = this.content, type = this.type!! @@ -19,7 +20,7 @@ fun Notification.toEntity(): NotificationEntity = NotificationEntity( id = this.id.value, userId = this.userId.value.toString(), - redirectId = this.redirectId.toString(), + redirectId = this.redirectId.value.toString(), title = this.title, content = this.content, type = this.type From 27ba90c354778e670d4ee1dc56e9839c9d930300 Mon Sep 17 00:00:00 2001 From: twoosky Date: Wed, 6 Dec 2023 06:34:14 +0900 Subject: [PATCH 27/35] =?UTF-8?q?chore:=20internal-api=20=EB=AA=A8?= =?UTF-8?q?=EB=93=88=20application.yml=20=ED=8C=8C=EC=9D=BC=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bootstrap/src/main/resources/application.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/bootstrap/src/main/resources/application.yml b/bootstrap/src/main/resources/application.yml index d8bc322..6703b35 100644 --- a/bootstrap/src/main/resources/application.yml +++ b/bootstrap/src/main/resources/application.yml @@ -4,3 +4,4 @@ spring: - application-push.yml - application-dynamodb.yml - application-message.yml + - application-internal.yml From 2840e651ab1e73715888fc48ecb7a5290ab7a71b Mon Sep 17 00:00:00 2001 From: twoosky Date: Wed, 6 Dec 2023 06:35:41 +0900 Subject: [PATCH 28/35] =?UTF-8?q?refactor:=20SQS=20=EB=A9=94=EC=8B=9C?= =?UTF-8?q?=EC=A7=80=20zero-payload=20=EB=B0=A9=EC=8B=9D=EC=9C=BC=EB=A1=9C?= =?UTF-8?q?=20=EC=9E=AC=EC=A0=95=EC=9D=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/kotlin/gloddy/payload/apply/ApplyPayload.kt | 9 +++++---- .../kotlin/gloddy/payload/group/GroupArticlePayload.kt | 8 ++++---- .../kotlin/gloddy/payload/group/GroupMemberPayload.kt | 8 +++++--- .../src/main/kotlin/gloddy/payload/group/GroupPayload.kt | 8 +++++--- .../main/kotlin/gloddy/payload/group/GroupPayloadType.kt | 2 +- 5 files changed, 20 insertions(+), 15 deletions(-) diff --git a/in-adapter-messaging/src/main/kotlin/gloddy/payload/apply/ApplyPayload.kt b/in-adapter-messaging/src/main/kotlin/gloddy/payload/apply/ApplyPayload.kt index 01383a2..5400538 100644 --- a/in-adapter-messaging/src/main/kotlin/gloddy/payload/apply/ApplyPayload.kt +++ b/in-adapter-messaging/src/main/kotlin/gloddy/payload/apply/ApplyPayload.kt @@ -1,8 +1,9 @@ package gloddy.payload.apply +import java.time.LocalDateTime + data class ApplyPayload ( - val userId: Long, - val applyGroupId: Long, - val applyUserId: Long, - val eventType: ApplyPayloadType + val applyId: Long, + val eventType: ApplyPayloadType, + val eventDateTime: LocalDateTime ) diff --git a/in-adapter-messaging/src/main/kotlin/gloddy/payload/group/GroupArticlePayload.kt b/in-adapter-messaging/src/main/kotlin/gloddy/payload/group/GroupArticlePayload.kt index 54c21b7..75a5c3d 100644 --- a/in-adapter-messaging/src/main/kotlin/gloddy/payload/group/GroupArticlePayload.kt +++ b/in-adapter-messaging/src/main/kotlin/gloddy/payload/group/GroupArticlePayload.kt @@ -1,9 +1,9 @@ package gloddy.payload.group +import java.time.LocalDateTime + data class GroupArticlePayload( - val userId: Long, - val groupId: Long, - val groupMemberUserIds: List, val articleId: Long, - val eventType: GroupArticlePayloadType + val eventType: GroupArticlePayloadType, + val eventDateTime: LocalDateTime ) \ No newline at end of file diff --git a/in-adapter-messaging/src/main/kotlin/gloddy/payload/group/GroupMemberPayload.kt b/in-adapter-messaging/src/main/kotlin/gloddy/payload/group/GroupMemberPayload.kt index 2d5ba0d..eb5e132 100644 --- a/in-adapter-messaging/src/main/kotlin/gloddy/payload/group/GroupMemberPayload.kt +++ b/in-adapter-messaging/src/main/kotlin/gloddy/payload/group/GroupMemberPayload.kt @@ -1,7 +1,9 @@ package gloddy.payload.group +import java.time.LocalDateTime + data class GroupMemberPayload( - val userId: Long, - val groupId: Long, - val eventType: GroupMemberPayloadType + val groupMemberId: Long, + val eventType: GroupMemberPayloadType, + val eventDateTime: LocalDateTime ) \ No newline at end of file diff --git a/in-adapter-messaging/src/main/kotlin/gloddy/payload/group/GroupPayload.kt b/in-adapter-messaging/src/main/kotlin/gloddy/payload/group/GroupPayload.kt index c5cc805..53d41d3 100644 --- a/in-adapter-messaging/src/main/kotlin/gloddy/payload/group/GroupPayload.kt +++ b/in-adapter-messaging/src/main/kotlin/gloddy/payload/group/GroupPayload.kt @@ -1,7 +1,9 @@ package gloddy.payload.group -data class GroupStatusPayload( +import java.time.LocalDateTime + +data class GroupPayload( val groupId: Long, - val groupMemberUserIds: List, - val eventType: GroupStatusPayloadType + val eventType: GroupPayloadType, + val eventDateTime: LocalDateTime ) \ No newline at end of file diff --git a/in-adapter-messaging/src/main/kotlin/gloddy/payload/group/GroupPayloadType.kt b/in-adapter-messaging/src/main/kotlin/gloddy/payload/group/GroupPayloadType.kt index fe3b962..e0021a3 100644 --- a/in-adapter-messaging/src/main/kotlin/gloddy/payload/group/GroupPayloadType.kt +++ b/in-adapter-messaging/src/main/kotlin/gloddy/payload/group/GroupPayloadType.kt @@ -1,6 +1,6 @@ package gloddy.payload.group -enum class GroupStatusPayloadType { +enum class GroupPayloadType { APPROACHING_GROUP, END_GROUP } \ No newline at end of file From c15d443cab6e4f52ddadf1e60aea3e4a728e3bb3 Mon Sep 17 00:00:00 2001 From: twoosky Date: Wed, 6 Dec 2023 06:36:44 +0900 Subject: [PATCH 29/35] =?UTF-8?q?fix:=20application=20event=20mapper=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kotlin/gloddy/handler/InPayloadHandler.kt | 4 +- .../handler/mapper/ApplicationEventMapper.kt | 51 ++++++++++--------- .../kotlin/gloddy/sqs/util/MessageParser.kt | 6 +-- 3 files changed, 31 insertions(+), 30 deletions(-) diff --git a/in-adapter-messaging/src/main/kotlin/gloddy/handler/InPayloadHandler.kt b/in-adapter-messaging/src/main/kotlin/gloddy/handler/InPayloadHandler.kt index 2a80f34..17167d4 100644 --- a/in-adapter-messaging/src/main/kotlin/gloddy/handler/InPayloadHandler.kt +++ b/in-adapter-messaging/src/main/kotlin/gloddy/handler/InPayloadHandler.kt @@ -6,7 +6,7 @@ import gloddy.notification.port.`in`.GroupNotificationCreateUseCase import gloddy.payload.apply.ApplyPayload import gloddy.payload.group.GroupArticlePayload import gloddy.payload.group.GroupMemberPayload -import gloddy.payload.group.GroupStatusPayload +import gloddy.payload.group.GroupPayload import org.springframework.stereotype.Component @Component @@ -29,7 +29,7 @@ class InPayloadHandler( groupNotificationCreateUseCase.create(groupArticleEvent) } - fun handleGroupStatusPayload(payload: GroupStatusPayload) { + fun handleGroupStatusPayload(payload: GroupPayload) { val groupStatusEvent = payload.toDomainEvent() groupNotificationCreateUseCase.create(groupStatusEvent) } diff --git a/in-adapter-messaging/src/main/kotlin/gloddy/handler/mapper/ApplicationEventMapper.kt b/in-adapter-messaging/src/main/kotlin/gloddy/handler/mapper/ApplicationEventMapper.kt index e0bf06c..aa58b61 100644 --- a/in-adapter-messaging/src/main/kotlin/gloddy/handler/mapper/ApplicationEventMapper.kt +++ b/in-adapter-messaging/src/main/kotlin/gloddy/handler/mapper/ApplicationEventMapper.kt @@ -1,42 +1,43 @@ package gloddy.handler.mapper -import gloddy.notification.ApplyEventType -import gloddy.notification.GroupEventType -import gloddy.notification.UserId -import gloddy.notification.dto.* +import gloddy.notification.dto.event.eventType.ApplyEventType +import gloddy.notification.dto.event.eventType.GroupMemberEventType +import gloddy.notification.dto.event.ApplyEvent +import gloddy.notification.dto.event.GroupArticleEvent +import gloddy.notification.dto.event.GroupEvent +import gloddy.notification.dto.event.GroupMemberEvent +import gloddy.notification.dto.event.eventType.GroupArticleEventType +import gloddy.notification.dto.event.eventType.GroupEventType import gloddy.payload.apply.ApplyPayload import gloddy.payload.apply.ApplyPayloadType import gloddy.payload.group.* fun GroupArticlePayload.toDomainEvent(): GroupArticleEvent = GroupArticleEvent( - userId = UserId(this.userId), - groupId = this.groupId, - groupMemberUserIds = this.groupMemberUserIds.map { UserId(it) }, articleId = this.articleId, - eventType = this.eventType.toDomainEventType() + eventType = this.eventType.toDomainEventType(), + eventDateTime = this.eventDateTime ) -fun GroupStatusPayload.toDomainEvent(): GroupStatusEvent = - GroupStatusEvent( - groupId = this.groupId, - groupMemberUserIds = this.groupMemberUserIds.map { UserId(it) }, - eventType = this.eventType.toDomainEventType() +fun GroupMemberPayload.toDomainEvent(): GroupMemberEvent = + GroupMemberEvent( + groupMemberId = this.groupMemberId, + eventType = this.eventType.toDomainEventType(), + eventDateTime = this.eventDateTime ) fun ApplyPayload.toDomainEvent(): ApplyEvent = ApplyEvent( - userId = UserId(this.userId), - applyGroupId = this.applyGroupId, - applyUserId = UserId(this.applyUserId), - eventType = this.eventType.toDomainEventType() + applyId = this.applyId, + eventType = this.eventType.toDomainEventType(), + eventDateTime = this.eventDateTime ) -fun GroupMemberPayload.toDomainEvent(): GroupEvent = +fun GroupPayload.toDomainEvent(): GroupEvent = GroupEvent( - userId = UserId(this.userId), groupId = this.groupId, - eventType = this.eventType.toDomainEventType() + eventType = this.eventType.toDomainEventType(), + eventDateTime = this.eventDateTime ) private fun GroupArticlePayloadType.toDomainEventType(): GroupArticleEventType = when(this) { @@ -44,10 +45,10 @@ private fun GroupArticlePayloadType.toDomainEventType(): GroupArticleEventType = GroupArticlePayloadType.CREATE_NOTICE_ARTICLE -> GroupArticleEventType.GROUP_ARTICLE_CREATE } -private fun GroupStatusPayloadType.toDomainEventType(): GroupStatusEventType = +private fun GroupPayloadType.toDomainEventType(): GroupEventType = when(this) { - GroupStatusPayloadType.APPROACHING_GROUP -> GroupStatusEventType.GROUP_APPROACHING_START - GroupStatusPayloadType.END_GROUP -> GroupStatusEventType.GROUP_END + GroupPayloadType.APPROACHING_GROUP -> GroupEventType.GROUP_APPROACHING_START + GroupPayloadType.END_GROUP -> GroupEventType.GROUP_END } private fun ApplyPayloadType.toDomainEventType(): ApplyEventType = @@ -57,7 +58,7 @@ private fun ApplyPayloadType.toDomainEventType(): ApplyEventType = ApplyPayloadType.APPLY_REFUSE -> ApplyEventType.APPLY_REFUSE } -private fun GroupMemberPayloadType.toDomainEventType(): GroupEventType = +private fun GroupMemberPayloadType.toDomainEventType(): GroupMemberEventType = when(this) { - GroupMemberPayloadType.GROUP_MEMBER_LEAVE -> GroupEventType.GROUP_LEAVE + GroupMemberPayloadType.GROUP_MEMBER_LEAVE -> GroupMemberEventType.GROUP_LEAVE } diff --git a/in-adapter-messaging/src/main/kotlin/gloddy/sqs/util/MessageParser.kt b/in-adapter-messaging/src/main/kotlin/gloddy/sqs/util/MessageParser.kt index cf49e55..3c589f4 100644 --- a/in-adapter-messaging/src/main/kotlin/gloddy/sqs/util/MessageParser.kt +++ b/in-adapter-messaging/src/main/kotlin/gloddy/sqs/util/MessageParser.kt @@ -4,7 +4,7 @@ import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper import gloddy.payload.apply.ApplyPayload import gloddy.payload.group.GroupArticlePayload import gloddy.payload.group.GroupMemberPayload -import gloddy.payload.group.GroupStatusPayload +import gloddy.payload.group.GroupPayload class MessageParser { @@ -26,9 +26,9 @@ class MessageParser { return objectMapper.readValue(payload, GroupArticlePayload::class.java) } - fun parseGroupStatusEvent(message: String): GroupStatusPayload { + fun parseGroupStatusEvent(message: String): GroupPayload { val payload = parsePayloadFromMessage(message); - return objectMapper.readValue(payload, GroupStatusPayload::class.java) + return objectMapper.readValue(payload, GroupPayload::class.java) } private fun parsePayloadFromMessage(message: String): String { From dc8fa74b213aceca2bc569ccde73dec7bedd48de Mon Sep 17 00:00:00 2001 From: twoosky Date: Wed, 6 Dec 2023 06:44:34 +0900 Subject: [PATCH 30/35] =?UTF-8?q?fix:=20push=20=EB=AA=A8=EB=93=88=20notifi?= =?UTF-8?q?cation=20title=EA=B0=92=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../event/NotificationCreateEvent.kt | 3 ++- .../kotlin/gloddy/command/GroupingPushType.kt | 23 +++++++------------ .../gloddy/command/PushCommandMapper.kt | 13 +++++------ 3 files changed, 16 insertions(+), 23 deletions(-) diff --git a/notification-application/src/main/kotlin/gloddy/notification/event/NotificationCreateEvent.kt b/notification-application/src/main/kotlin/gloddy/notification/event/NotificationCreateEvent.kt index 834714d..0aeebcb 100644 --- a/notification-application/src/main/kotlin/gloddy/notification/event/NotificationCreateEvent.kt +++ b/notification-application/src/main/kotlin/gloddy/notification/event/NotificationCreateEvent.kt @@ -2,6 +2,7 @@ package gloddy.notification.event import gloddy.notification.Notification import gloddy.notification.NotificationType +import gloddy.notification.RedirectId import gloddy.notification.UserId fun Notification.toNotificationCreateEvent(): NotificationCreateEvent = @@ -13,6 +14,6 @@ fun Notification.toNotificationCreateEvent(): NotificationCreateEvent = class NotificationCreateEvent( val userId: UserId, - val redirectId: Long, + val redirectId: RedirectId, val type: NotificationType ) : NotificationEvent \ No newline at end of file diff --git a/push/src/main/kotlin/gloddy/command/GroupingPushType.kt b/push/src/main/kotlin/gloddy/command/GroupingPushType.kt index 8ae9c1c..5ae865e 100644 --- a/push/src/main/kotlin/gloddy/command/GroupingPushType.kt +++ b/push/src/main/kotlin/gloddy/command/GroupingPushType.kt @@ -3,28 +3,28 @@ package gloddy.command import gloddy.notification.NotificationType enum class GroupingPushType( - private val title: String, + val title: (String?) -> String, val content: String, val isRequiredPush: Boolean ) { - APPLY_APPROVE("Your applied gathering has been approved! 👌", + APPLY_APPROVE({ "Your applied gathering has been approved! 👌" }, "Wishing you enjoy a fun and safe gathering.", true), - APPLY_REFUSE("The gathering you applied for has been declined. \uD83E\uDD72", + APPLY_REFUSE({ "The gathering you applied for has been declined. \uD83E\uDD72" }, "There are various other gatherings available for you! Would you like to look for another gathering?", false), - APPLY_CREATE("A new gathering application has arrived! 💌", + APPLY_CREATE({ "A new gathering application has arrived! 💌" }, "We’re awaiting the host’s approval for the gathering! please warmly welcome the new members.", true), - GROUP_LEAVE("has just left the group. \uD83E\uDD72", + GROUP_LEAVE({ value: String? -> "$value has just left the group. \uD83E\uDD72" }, "Shall we go check the group participants?", true), - GROUP_ARTICLE_CREATE("Please Check the New Notice! \uD83D\uDDE3", + GROUP_ARTICLE_CREATE({ "Please Check the New Notice! \uD83D\uDDE3" }, "A new post has been added.", true), - GROUP_APPROACHING_START("The gathering starts in 1 hour! ⏰", + GROUP_APPROACHING_START({ "The gathering starts in 1 hour! ⏰" }, "Are you ready to enjoy the gathering? \n" + "Check the announcement for a better gathering!", true), - GROUP_END("Did you enjoy the gathering? \uD83D\uDE06", + GROUP_END({ "Did you enjoy the gathering? \uD83D\uDE06" }, "Please rate the attendees of the gathering! \n" + "Select the best partner with reward stickers.", false) @@ -37,11 +37,4 @@ enum class GroupingPushType( ?: throw RuntimeException("not found groupingPushType") } } - - fun getTitle(name: String = "member"): String { - return when(this) { - in listOf(GROUP_LEAVE) -> "'${name}' ${title}" - else -> title - } - } } \ No newline at end of file diff --git a/push/src/main/kotlin/gloddy/command/PushCommandMapper.kt b/push/src/main/kotlin/gloddy/command/PushCommandMapper.kt index 5816b76..ee31e83 100644 --- a/push/src/main/kotlin/gloddy/command/PushCommandMapper.kt +++ b/push/src/main/kotlin/gloddy/command/PushCommandMapper.kt @@ -2,18 +2,17 @@ package gloddy.command import gloddy.notification.event.NotificationCreateEvent -fun NotificationCreateEvent.toGroupingPushCommand(name: String = "member"): PushCommand { - +fun NotificationCreateEvent.toGroupingPushCommand(name: String? = "member"): PushCommand { val pushType = GroupingPushType.from(this.type) return GroupingPushCommand( userId = this.userId, - title = pushType.getTitle(name), + title = pushType.title(name), content = pushType.content, - payload = buildMap { - put("redirectId", this@toGroupingPushCommand.redirectId.toString()) - put("type", pushType.name) - }, + payload = mapOf( + "redirectId" to this.redirectId.value.toString(), + "type" to pushType.name + ), pushType.isRequiredPush ) } From 61d7eb5978a1295cad3293cf5911e73ac1a42074 Mon Sep 17 00:00:00 2001 From: twoosky Date: Wed, 6 Dec 2023 07:04:28 +0900 Subject: [PATCH 31/35] =?UTF-8?q?feat:=20notification=20domain=20=EA=B0=9D?= =?UTF-8?q?=EC=B2=B4=EC=97=90=20image=20=ED=95=84=EB=93=9C=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/kotlin/gloddy/notification/Notification.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/notification-domain/src/main/kotlin/gloddy/notification/Notification.kt b/notification-domain/src/main/kotlin/gloddy/notification/Notification.kt index f287721..97b1b79 100644 --- a/notification-domain/src/main/kotlin/gloddy/notification/Notification.kt +++ b/notification-domain/src/main/kotlin/gloddy/notification/Notification.kt @@ -1,5 +1,6 @@ package gloddy.notification +import java.time.LocalDateTime import java.util.* @@ -13,10 +14,12 @@ value class RedirectId(val value: Long) value class NotificationId(val value: String) data class Notification( - val id: NotificationId = NotificationId(UUID.randomUUID().toString()), + val id: NotificationId? = NotificationId(UUID.randomUUID().toString()), val userId: UserId, val redirectId: RedirectId, val title: String, val content: String, - val type: NotificationType + val type: NotificationType, + val image: String, + val createdAt: LocalDateTime? = LocalDateTime.now() ) \ No newline at end of file From 418a2aaac2b32d1299b350c3dce9b977120a5728 Mon Sep 17 00:00:00 2001 From: twoosky Date: Wed, 6 Dec 2023 07:05:02 +0900 Subject: [PATCH 32/35] =?UTF-8?q?feat:=20notification=20=EA=B0=9D=EC=B2=B4?= =?UTF-8?q?=20=EC=83=9D=EC=84=B1=20=ED=95=84=EB=93=9C=EC=97=90=20groupImag?= =?UTF-8?q?e=EA=B0=92=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../notification/dto/payload/GroupMemberPayload.kt | 2 +- .../service/ApplyNotificationCreateService.kt | 3 ++- .../service/GroupNotificationCreateService.kt | 9 ++++++--- .../notification/service/NotificationGetService.kt | 1 - 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/notification-application/src/main/kotlin/gloddy/notification/dto/payload/GroupMemberPayload.kt b/notification-application/src/main/kotlin/gloddy/notification/dto/payload/GroupMemberPayload.kt index b459724..974c1e4 100644 --- a/notification-application/src/main/kotlin/gloddy/notification/dto/payload/GroupMemberPayload.kt +++ b/notification-application/src/main/kotlin/gloddy/notification/dto/payload/GroupMemberPayload.kt @@ -4,5 +4,5 @@ data class GroupMemberPayload ( val groupId: Long, val captainId: Long, val groupMemberName: String, - val groupImage: Long + val groupImage: String ) \ No newline at end of file diff --git a/notification-application/src/main/kotlin/gloddy/notification/service/ApplyNotificationCreateService.kt b/notification-application/src/main/kotlin/gloddy/notification/service/ApplyNotificationCreateService.kt index a73d7a1..5abd41a 100644 --- a/notification-application/src/main/kotlin/gloddy/notification/service/ApplyNotificationCreateService.kt +++ b/notification-application/src/main/kotlin/gloddy/notification/service/ApplyNotificationCreateService.kt @@ -27,7 +27,8 @@ class ApplyNotificationCreateService( redirectId = RedirectId(payload.groupId), title = notificationType.title(null), content = notificationType.content, - type = notificationType + type = notificationType, + image = payload.groupImage ).run { notificationCreatePort.save(this) notificationEventPublisher.publishEvent(this.toNotificationCreateEvent()) diff --git a/notification-application/src/main/kotlin/gloddy/notification/service/GroupNotificationCreateService.kt b/notification-application/src/main/kotlin/gloddy/notification/service/GroupNotificationCreateService.kt index 97c9e77..2331ce5 100644 --- a/notification-application/src/main/kotlin/gloddy/notification/service/GroupNotificationCreateService.kt +++ b/notification-application/src/main/kotlin/gloddy/notification/service/GroupNotificationCreateService.kt @@ -28,7 +28,8 @@ class GroupNotificationCreateService( redirectId = RedirectId(payload.groupId), title = notificationType.title(null), content = notificationType.content, - type = notificationType + type = notificationType, + image = payload.groupImage ).run { notificationCreatePort.save(this) notificationEventPublisher.publishEvent(this.toNotificationCreateEvent()) @@ -45,7 +46,8 @@ class GroupNotificationCreateService( redirectId = RedirectId(payload.groupId), title = notificationType.title(payload.groupMemberName), content = notificationType.content, - type = notificationType + type = notificationType, + image = payload.groupImage ).run { notificationCreatePort.save(this) notificationEventPublisher.publishEvent(this.toNotificationCreateEvent()) @@ -63,7 +65,8 @@ class GroupNotificationCreateService( redirectId = RedirectId(payload.groupId), title = notificationType.title(null), content = notificationType.content, - type = notificationType + type = notificationType, + image = payload.groupImage ).run { notificationCreatePort.save(this) notificationEventPublisher.publishEvent(this.toNotificationCreateEvent()) diff --git a/notification-application/src/main/kotlin/gloddy/notification/service/NotificationGetService.kt b/notification-application/src/main/kotlin/gloddy/notification/service/NotificationGetService.kt index d1fda1c..ab91a33 100644 --- a/notification-application/src/main/kotlin/gloddy/notification/service/NotificationGetService.kt +++ b/notification-application/src/main/kotlin/gloddy/notification/service/NotificationGetService.kt @@ -13,5 +13,4 @@ class NotificationGetService( override fun getAllByUser(dto: NotificationGetDto): List = notificationGetPort.findByUserId(dto.userId) - } \ No newline at end of file From 3c0493cd1cf21c44ca9d47b80a77b1763566a662 Mon Sep 17 00:00:00 2001 From: twoosky Date: Wed, 6 Dec 2023 07:05:24 +0900 Subject: [PATCH 33/35] =?UTF-8?q?feat:=20notification=20entity=EC=97=90=20?= =?UTF-8?q?image=20=EC=BB=AC=EB=9F=BC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gloddy/dynamodb/notification/NotificationEntity.kt | 3 +++ .../gloddy/dynamodb/notification/NotificationMapper.kt | 8 +++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/notification-out-adapter-persistence/src/main/kotlin/gloddy/dynamodb/notification/NotificationEntity.kt b/notification-out-adapter-persistence/src/main/kotlin/gloddy/dynamodb/notification/NotificationEntity.kt index 72cb324..455017c 100644 --- a/notification-out-adapter-persistence/src/main/kotlin/gloddy/dynamodb/notification/NotificationEntity.kt +++ b/notification-out-adapter-persistence/src/main/kotlin/gloddy/dynamodb/notification/NotificationEntity.kt @@ -31,6 +31,9 @@ class NotificationEntity( @field:DynamoDBTypeConverted(converter = NotificationTypeConverter::class) var type: NotificationType? = null, + @field:DynamoDBAttribute(attributeName = "image") + var image: String = "", + @field:DynamoDBAttribute(attributeName = "created_at") @field:DynamoDBTypeConverted(converter = LocalDateTimeConverter::class) @field:DynamoDBIndexRangeKey(globalSecondaryIndexName = "user_id-created_at-index") diff --git a/notification-out-adapter-persistence/src/main/kotlin/gloddy/dynamodb/notification/NotificationMapper.kt b/notification-out-adapter-persistence/src/main/kotlin/gloddy/dynamodb/notification/NotificationMapper.kt index 5bc58c7..5d88853 100644 --- a/notification-out-adapter-persistence/src/main/kotlin/gloddy/dynamodb/notification/NotificationMapper.kt +++ b/notification-out-adapter-persistence/src/main/kotlin/gloddy/dynamodb/notification/NotificationMapper.kt @@ -13,15 +13,17 @@ fun NotificationEntity.toDomain(): Notification = redirectId = RedirectId(this.redirectId.toLong()), title = this.title, content = this.content, - type = this.type!! + type = this.type!!, + image = this.image, + createdAt = this.createdAt ) fun Notification.toEntity(): NotificationEntity = NotificationEntity( - id = this.id.value, userId = this.userId.value.toString(), redirectId = this.redirectId.value.toString(), title = this.title, content = this.content, - type = this.type + type = this.type, + image = this.image ) \ No newline at end of file From e6268b2b877c7af0ba56c43187780accdc8a3436 Mon Sep 17 00:00:00 2001 From: twoosky Date: Wed, 6 Dec 2023 07:05:51 +0900 Subject: [PATCH 34/35] =?UTF-8?q?feat:=20=EC=95=8C=EB=A6=BC=20=EB=AA=A9?= =?UTF-8?q?=EB=A1=9D=20=EC=A1=B0=ED=9A=8C=20=EC=9D=91=EB=8B=B5=EC=97=90=20?= =?UTF-8?q?image,=20createAt=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../notification/dto/NotificationGetResponse.kt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/notification-in-adapter-api/src/main/kotlin/gloddy/notification/dto/NotificationGetResponse.kt b/notification-in-adapter-api/src/main/kotlin/gloddy/notification/dto/NotificationGetResponse.kt index dec01b2..0216667 100644 --- a/notification-in-adapter-api/src/main/kotlin/gloddy/notification/dto/NotificationGetResponse.kt +++ b/notification-in-adapter-api/src/main/kotlin/gloddy/notification/dto/NotificationGetResponse.kt @@ -2,6 +2,7 @@ package gloddy.notification.dto import gloddy.notification.Notification import gloddy.notification.NotificationType +import gloddy.notification.RedirectId import gloddy.notification.UserId data class NotificationGetResponse( @@ -10,10 +11,12 @@ data class NotificationGetResponse( data class NotificationDto( val userId: UserId, - val redirectId: Long, + val redirectId: RedirectId, val title: String, val content: String, - val type: NotificationType + val type: NotificationType, + val createdAt: String, + val groupImage: String ) fun List.toResponse(): NotificationGetResponse = @@ -27,5 +30,7 @@ fun Notification.toDto(): NotificationDto = redirectId = this.redirectId, title = this.title, content = this.content, - type = this.type + type = this.type, + createdAt = this.createdAt.toString(), + groupImage = this.image ) \ No newline at end of file From a1db43d682bb93836f195a64d9dfa212c9ba6136 Mon Sep 17 00:00:00 2001 From: twoosky Date: Fri, 8 Dec 2023 19:21:08 +0900 Subject: [PATCH 35/35] =?UTF-8?q?fix:=20ObjectMapper=20LocalDateTime=20?= =?UTF-8?q?=EC=97=AD=EC=A7=88=EB=A0=AC=ED=99=94=20=EC=84=A4=EC=A0=95=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- in-adapter-messaging/build.gradle.kts | 3 ++- .../src/main/kotlin/gloddy/sqs/util/MessageParser.kt | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/in-adapter-messaging/build.gradle.kts b/in-adapter-messaging/build.gradle.kts index 77bcd22..fc97733 100644 --- a/in-adapter-messaging/build.gradle.kts +++ b/in-adapter-messaging/build.gradle.kts @@ -11,6 +11,7 @@ dependencies { implementation(project(":notification-domain")) //aws sqs implementation("com.fasterxml.jackson.module:jackson-module-kotlin") - implementation(platform("io.awspring.cloud:spring-cloud-aws-dependencies:3.0.0")) + implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.9.5") + implementation(platform("io.awspring.cloud:spring-cloud-aws-dependencies:3.0.3")) implementation("io.awspring.cloud:spring-cloud-aws-starter-sqs") } diff --git a/in-adapter-messaging/src/main/kotlin/gloddy/sqs/util/MessageParser.kt b/in-adapter-messaging/src/main/kotlin/gloddy/sqs/util/MessageParser.kt index 3c589f4..60caff5 100644 --- a/in-adapter-messaging/src/main/kotlin/gloddy/sqs/util/MessageParser.kt +++ b/in-adapter-messaging/src/main/kotlin/gloddy/sqs/util/MessageParser.kt @@ -1,5 +1,6 @@ package gloddy.sqs.util +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper import gloddy.payload.apply.ApplyPayload import gloddy.payload.group.GroupArticlePayload @@ -9,7 +10,7 @@ import gloddy.payload.group.GroupPayload class MessageParser { companion object{ - private val objectMapper = jacksonObjectMapper() + private val objectMapper = jacksonObjectMapper().registerModule(JavaTimeModule()) fun parseApplyEvent(message: String): ApplyPayload { val payload = parsePayloadFromMessage(message)