Skip to content

Commit

Permalink
[feat]#232: 온보딩 model 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
flash159483 committed Feb 1, 2025
1 parent 11aa2cf commit d155e73
Show file tree
Hide file tree
Showing 13 changed files with 171 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.bff.wespot.model.serverDriven

interface BaseComponent
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.bff.wespot.model.serverDriven

data class ButtonComponent(
val text: String,
) : BaseComponent
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.bff.wespot.model.serverDriven

data class ImageComponent(
val url: String,
val width: Int,
val height: Int,
) : BaseComponent
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.bff.wespot.model.serverDriven

data class OnBoarding(
val id: Int,
val name: String,
val data: List<OnBoardingContent>,
)

data class OnBoardingContent(
val page: Int,
val data: List<BaseComponent>,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.bff.wespot.model.serverDriven

enum class OnBoardingCategory {
VOTE,
MESSAGE,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.bff.wespot.model.serverDriven

data class TextListComponent(
val textList: List<TextList>,
) : BaseComponent

data class TextList(
val icon: String,
val text: String,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.bff.wespot.model.serverDriven

data class TitleComponent(
val text: String,
) : BaseComponent
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.bff.wespot.data.remote.model.serverDriven

import com.bff.wespot.model.serverDriven.BaseComponent
import kotlinx.serialization.Serializable

@Serializable
sealed interface BaseComponentDto {
fun toDomain(): BaseComponent
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.bff.wespot.data.remote.model.serverDriven

import com.bff.wespot.model.serverDriven.ButtonComponent
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
@SerialName("buttonComponent")
data class ButtonComponentDto(
val text: String
) : BaseComponentDto {
override fun toDomain(): ButtonComponent {
return ButtonComponent(
text = text
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.bff.wespot.data.remote.model.serverDriven

import com.bff.wespot.model.serverDriven.ImageComponent
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
@SerialName("imageComponent")
data class ImageComponentDto(
val url: String,
val width: Int,
val height: Int
) : BaseComponentDto {
override fun toDomain(): ImageComponent {
return ImageComponent(
url = url,
width = width,
height = height
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.bff.wespot.data.remote.model.serverDriven

import com.bff.wespot.model.serverDriven.OnBoarding
import com.bff.wespot.model.serverDriven.OnBoardingContent
import kotlinx.serialization.Serializable

@Serializable
data class OnBoardingDto(
val id: Int,
val name: String,
val data: List<OnBoardingContentDto>
) {
fun toDomain() = OnBoarding(
id = id,
name = name,
data = data.map { it.toDomain() }
)
}

@Serializable
data class OnBoardingContentDto(
val page: Int,
val data: List<BaseComponentDto>
) {
fun toDomain() = OnBoardingContent(
page = page,
data = data.map { it.toDomain() }
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.bff.wespot.data.remote.model.serverDriven

import com.bff.wespot.model.serverDriven.TextList
import com.bff.wespot.model.serverDriven.TextListComponent
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
@SerialName("textListComponent")
data class TextListComponentDto(
val textList: List<TextListDto>
) : BaseComponentDto {
override fun toDomain(): TextListComponent {
return TextListComponent(
textList = textList.map { it.toDomain() }
)
}
}

@Serializable
data class TextListDto(
val icon: String,
val text: String
) {
fun toDomain() = TextList(
icon = icon,
text = text
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.bff.wespot.data.remote.model.serverDriven

import com.bff.wespot.model.serverDriven.TitleComponent
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
@SerialName("titleComponent")
data class TitleComponentDto(
val text: String

) : BaseComponentDto {
override fun toDomain(): TitleComponent {
return TitleComponent(
text = text
)
}
}

0 comments on commit d155e73

Please sign in to comment.