From e5593c6b75fcc3c1fafbd93936ff21ecc14d0e87 Mon Sep 17 00:00:00 2001 From: kpeel Date: Tue, 6 May 2025 20:46:55 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=98=A8=EB=B3=B4=EB=94=A9=20=EC=8B=9C?= =?UTF-8?q?=ED=8A=B8=20=EC=A1=B0=ED=9A=8C=20API=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/dto/OnBoardingComponentRequest.kt | 1 + .../wespot/common/dto/OnBoardingResponse.kt | 34 ++++++++---- .../common/service/view/OnBoardingService.kt | 19 ++++++- .../message/service/v2/GetMessageV2Service.kt | 4 +- .../wespot/common/ViewedOnBoardingSheet.kt | 5 ++ .../view/OnBoardingBottomSheetComponent.kt | 13 ++++- .../com/wespot/view/OnBoardingCategory.kt | 3 + .../view/OnBoardingExplanationComponent.kt | 55 +++++++++++++++++++ 8 files changed, 115 insertions(+), 19 deletions(-) diff --git a/core/src/main/kotlin/com/wespot/common/dto/OnBoardingComponentRequest.kt b/core/src/main/kotlin/com/wespot/common/dto/OnBoardingComponentRequest.kt index faa4ecf7..043fa1e9 100644 --- a/core/src/main/kotlin/com/wespot/common/dto/OnBoardingComponentRequest.kt +++ b/core/src/main/kotlin/com/wespot/common/dto/OnBoardingComponentRequest.kt @@ -4,6 +4,7 @@ enum class OnBoardingComponentRequest { MESSAGE, VOTE, + ANSWER_MESSAGE, ; } diff --git a/core/src/main/kotlin/com/wespot/common/dto/OnBoardingResponse.kt b/core/src/main/kotlin/com/wespot/common/dto/OnBoardingResponse.kt index 227927b4..d89c1733 100644 --- a/core/src/main/kotlin/com/wespot/common/dto/OnBoardingResponse.kt +++ b/core/src/main/kotlin/com/wespot/common/dto/OnBoardingResponse.kt @@ -5,6 +5,8 @@ import com.wespot.common.dto.view.ImageComponentResponse import com.wespot.common.dto.view.TextComponentResponse import com.wespot.common.dto.view.TextListComponentResponse import com.wespot.view.OnBoardingBottomSheetComponent +import com.wespot.view.OnBoardingExplanationComponent +import com.wespot.view.OnBoardingWelcomePageComponent data class OnBoardingResponse( val id: Long, @@ -14,33 +16,41 @@ data class OnBoardingResponse( companion object { - fun fromFirstPage(onBoardingBottomSheetComponent: OnBoardingBottomSheetComponent): OnBoardingResponse { + fun fromFirstPage( + id: Long = 1, + onBoardingBottomSheetComponentName: String, + onBoardingWelcomePageComponent: OnBoardingWelcomePageComponent + ): OnBoardingResponse { return OnBoardingResponse( - id = 1, - name = onBoardingBottomSheetComponent.name, + id = id, + name = onBoardingBottomSheetComponentName, data = listOf( ContentSectionResponse.from( - TextComponentResponse.from(onBoardingBottomSheetComponent.onBoardingWelcomePageComponent.textComponent), - ImageComponentResponse.from(onBoardingBottomSheetComponent.onBoardingWelcomePageComponent.imageComponent) + TextComponentResponse.from(onBoardingWelcomePageComponent.textComponent), + ImageComponentResponse.from(onBoardingWelcomePageComponent.imageComponent) ), BottomSectionResponse.from( - ButtonsComponentResponse.from(onBoardingBottomSheetComponent.onBoardingWelcomePageComponent.buttonsComponent) + ButtonsComponentResponse.from(onBoardingWelcomePageComponent.buttonsComponent) ), ) ) } - fun fromSecondPage(onBoardingBottomSheetComponent: OnBoardingBottomSheetComponent): OnBoardingResponse { + fun fromSecondPage( + id: Long = 2, + onBoardingBottomSheetComponentName: String, + onBoardingExplanationComponent: OnBoardingExplanationComponent + ): OnBoardingResponse { return OnBoardingResponse( - id = 2, - name = onBoardingBottomSheetComponent.name, + id = id, + name = onBoardingBottomSheetComponentName, data = listOf( ContentSectionResponse.from( - TextComponentResponse.from(onBoardingBottomSheetComponent.onBoardingExplanationComponent.textComponent), - TextListComponentResponse.from(onBoardingBottomSheetComponent.onBoardingExplanationComponent.textListComponent) + TextComponentResponse.from(onBoardingExplanationComponent.textComponent), + TextListComponentResponse.from(onBoardingExplanationComponent.textListComponent) ), BottomSectionResponse.from( - ButtonsComponentResponse.from(onBoardingBottomSheetComponent.onBoardingExplanationComponent.buttonsComponent) + ButtonsComponentResponse.from(onBoardingExplanationComponent.buttonsComponent) ) ) ) diff --git a/core/src/main/kotlin/com/wespot/common/service/view/OnBoardingService.kt b/core/src/main/kotlin/com/wespot/common/service/view/OnBoardingService.kt index a78fb005..9f411a4a 100644 --- a/core/src/main/kotlin/com/wespot/common/service/view/OnBoardingService.kt +++ b/core/src/main/kotlin/com/wespot/common/service/view/OnBoardingService.kt @@ -19,6 +19,7 @@ class OnBoardingService( private val viewedOnBoardingSheetPort: ViewedOnBoardingSheetPort, ) : OnBoardingUseCase { + @Transactional(readOnly = true) override fun getOnBoardingComponents(category: OnBoardingComponentRequest): List { val userId = SecurityUtils.getLoginUser(userPort).id val viewedOnBoardingSheet = viewedOnBoardingSheetPort.findByUserId(userId) ?: throw CustomException( @@ -33,9 +34,21 @@ class OnBoardingService( val onBoardingBottomSheetComponent = OnBoardingBottomSheetComponent.fromWithCategory(category.name) - return listOf( - OnBoardingResponse.fromFirstPage(onBoardingBottomSheetComponent), - OnBoardingResponse.fromSecondPage(onBoardingBottomSheetComponent) + val firstPage = onBoardingBottomSheetComponent.onBoardingWelcomePageComponent + val secondPage = onBoardingBottomSheetComponent.onBoardingExplanationComponent + var pageId = 0L + + return listOfNotNull( + if (firstPage == null) null else OnBoardingResponse.fromFirstPage( + id = ++pageId, + onBoardingBottomSheetComponentName = onBoardingBottomSheetComponent.name, + onBoardingWelcomePageComponent = firstPage + ), + if (secondPage == null) null else OnBoardingResponse.fromSecondPage( + id = ++pageId, + onBoardingBottomSheetComponentName = onBoardingBottomSheetComponent.name, + onBoardingExplanationComponent = secondPage + ) ) } diff --git a/core/src/main/kotlin/com/wespot/message/service/v2/GetMessageV2Service.kt b/core/src/main/kotlin/com/wespot/message/service/v2/GetMessageV2Service.kt index e9448016..087479e7 100644 --- a/core/src/main/kotlin/com/wespot/message/service/v2/GetMessageV2Service.kt +++ b/core/src/main/kotlin/com/wespot/message/service/v2/GetMessageV2Service.kt @@ -37,9 +37,9 @@ class GetMessageV2Service( val loginUser = SecurityUtils.getLoginUser(userPort = userPort) val sentMessageRooms = - sentMessageRoomsFinder.invoke(loginUser.id) // messageV2Port.findAllMessageRoomBySenderId(senderId = loginUser.id) + sentMessageRoomsFinder.invoke(loginUser.id) val receivedMessageRooms = - receivedMessageRoomsFinder.invoke(loginUser.id) // messageV2Port.findAllMessageRoomByReceiverId(receiverId = loginUser.id) + receivedMessageRoomsFinder.invoke(loginUser.id) val rooms: List = sentMessageRooms + receivedMessageRooms diff --git a/domain/src/main/kotlin/com/wespot/common/ViewedOnBoardingSheet.kt b/domain/src/main/kotlin/com/wespot/common/ViewedOnBoardingSheet.kt index 12f423fc..6010bf25 100644 --- a/domain/src/main/kotlin/com/wespot/common/ViewedOnBoardingSheet.kt +++ b/domain/src/main/kotlin/com/wespot/common/ViewedOnBoardingSheet.kt @@ -13,6 +13,7 @@ data class ViewedOnBoardingSheet( companion object { private const val IS_MESSAGE_VIEW = "MESSAGE" private const val IS_VOTE_VIEW = "VOTE" + private const val IS_ANSWER_MESSAGE_VIEW = "ANSWER_MESSAGE" fun createInitialState( userId: Long, @@ -37,6 +38,10 @@ data class ViewedOnBoardingSheet( isViewedVoteOnBoardingSheet = true } + if (name == IS_ANSWER_MESSAGE_VIEW) { + isViewedAnswerMessageOnBoardingSheet = true + } + commited.call(this) } diff --git a/domain/src/main/kotlin/com/wespot/view/OnBoardingBottomSheetComponent.kt b/domain/src/main/kotlin/com/wespot/view/OnBoardingBottomSheetComponent.kt index 2bf2d0a2..a31e3c87 100644 --- a/domain/src/main/kotlin/com/wespot/view/OnBoardingBottomSheetComponent.kt +++ b/domain/src/main/kotlin/com/wespot/view/OnBoardingBottomSheetComponent.kt @@ -2,8 +2,8 @@ package com.wespot.view data class OnBoardingBottomSheetComponent( val name: String, - val onBoardingWelcomePageComponent: OnBoardingWelcomePageComponent, - val onBoardingExplanationComponent: OnBoardingExplanationComponent + val onBoardingWelcomePageComponent: OnBoardingWelcomePageComponent?, + val onBoardingExplanationComponent: OnBoardingExplanationComponent? ) { companion object { @@ -16,6 +16,7 @@ data class OnBoardingBottomSheetComponent( return when (onboardingCategory) { OnBoardingCategory.MESSAGE -> createMessageType() OnBoardingCategory.VOTE -> createVoteType() + OnBoardingCategory.ANSWER_MESSAGE -> createAnswerMessageType() } } @@ -35,6 +36,14 @@ data class OnBoardingBottomSheetComponent( ) } + private fun createAnswerMessageType(): OnBoardingBottomSheetComponent { + return OnBoardingBottomSheetComponent( + name = TYPE, + onBoardingWelcomePageComponent = null, + onBoardingExplanationComponent = OnBoardingExplanationComponent.createAnswerMessageComponent() + ) + } + } } diff --git a/domain/src/main/kotlin/com/wespot/view/OnBoardingCategory.kt b/domain/src/main/kotlin/com/wespot/view/OnBoardingCategory.kt index 63278fa5..5eb88309 100644 --- a/domain/src/main/kotlin/com/wespot/view/OnBoardingCategory.kt +++ b/domain/src/main/kotlin/com/wespot/view/OnBoardingCategory.kt @@ -9,15 +9,18 @@ enum class OnBoardingCategory { MESSAGE, VOTE, + ANSWER_MESSAGE, ; companion object { fun from(category: String): OnBoardingCategory { val findValue = valueOf(category.uppercase()) + if (Objects.isNull(findValue)) { throw CustomException(HttpStatus.BAD_REQUEST, ExceptionView.TOAST, "존재하지 않는 온보딩 바텀 sheet 타입입니다.") } + return findValue } diff --git a/domain/src/main/kotlin/com/wespot/view/OnBoardingExplanationComponent.kt b/domain/src/main/kotlin/com/wespot/view/OnBoardingExplanationComponent.kt index 29602b8a..2a4705ce 100644 --- a/domain/src/main/kotlin/com/wespot/view/OnBoardingExplanationComponent.kt +++ b/domain/src/main/kotlin/com/wespot/view/OnBoardingExplanationComponent.kt @@ -126,6 +126,61 @@ data class OnBoardingExplanationComponent( ) } + fun createAnswerMessageComponent(): OnBoardingExplanationComponent { + return OnBoardingExplanationComponent( + textComponent = TextComponent.of( + RichText.of("답장하기에 대해 알려드릴게요", "#FFF7F7F8", 20, "Center", "Bold"), + Paddings.of(bottom = 7) + ), + textListComponent = TextListComponent.from( + textLines = listOf( + Pair( + "https://dw2d2daekmyur.cloudfront.net/answer_message_01.png", + RichText.of( + "쪽지는 답장 쪽지를 포함하여 하루에 총 3개만 보낼 수 있어요", + "#FFF7F7F8", + 14, + "Start", + null + ) + ), + Pair( + "https://dw2d2daekmyur.cloudfront.net/answer_message_02.png", + RichText.of( + "상대에게 온 쪽지에 답장을 보내도 남은 쪽지 개수에서 차감돼요", + "#FFF7F7F8", + 14, + "Start", + null + ) + ), + Pair( + "https://dw2d2daekmyur.cloudfront.net/answer_message_03.png", + RichText.of( + "친구가 내 답장을 읽으면 알려드릴게요", + "#FFF7F7F8", + 14, + "Start", + null + ) + ), + ) + ), + buttonsComponent = ButtonsComponent.of( + listOf( + ButtonComponent.ofWithClickActionType( + RichText.of("이해했어요", "#FF1B1C1E", 16, "Center", "SemiBold"), + "#FFF6FE8B", + "#FFC0C66B", + OnClickActionType.ACTION, + Paddings.of(top = 8, bottom = 8) + ) + ), + Paddings.of(start = 20, end = 20, bottom = 12, top = 12) + ) + ) + } + } }