-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEATURE]#218 : 서버드리븐 Ui Component DTO Model 구현
- Loading branch information
1 parent
bf97353
commit 66141a3
Showing
5 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
data-remote/src/main/kotlin/com/bff/wespot/data/remote/model/dynamicui/FeatureOverviewDto.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.bff.wespot.data.remote.model.dynamicui | ||
|
||
import com.bff.wespot.data.remote.model.dynamicui.component.DynamicUiComponentDto | ||
import com.bff.wespot.data.remote.model.dynamicui.component.toDynamicUiComponent | ||
import com.bff.wespot.model.dynamicui.FeatureOverview | ||
import com.bff.wespot.model.dynamicui.component.ButtonComponent | ||
import com.bff.wespot.model.dynamicui.component.ImageComponent | ||
import com.bff.wespot.model.dynamicui.component.TextComponent | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class FeatureOverviewDto( | ||
val id: Int, | ||
val name: String, | ||
val data: List<DynamicUiComponentDto>, | ||
) { | ||
fun toFeatureOverview(): FeatureOverview = FeatureOverview( | ||
headerText = data[0].toDynamicUiComponent() as? TextComponent ?: TextComponent(), | ||
overview = data[1].toDynamicUiComponent() as? ImageComponent ?: ImageComponent(), | ||
dismissButton = data[2].toDynamicUiComponent() as? ButtonComponent ?: ButtonComponent(), | ||
navigateButton = data[3].toDynamicUiComponent() as? ButtonComponent ?: ButtonComponent(), | ||
) | ||
} |
11 changes: 11 additions & 0 deletions
11
...rc/main/kotlin/com/bff/wespot/data/remote/model/dynamicui/component/ButtonComponentDto.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.bff.wespot.data.remote.model.dynamicui.component | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
@SerialName("buttonComponent") | ||
data class ButtonComponentDto( | ||
val text: String, | ||
val link: String = "", | ||
): DynamicUiComponentDto |
18 changes: 18 additions & 0 deletions
18
...main/kotlin/com/bff/wespot/data/remote/model/dynamicui/component/DynamicUiComponentDto.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.bff.wespot.data.remote.model.dynamicui.component | ||
|
||
import com.bff.wespot.model.dynamicui.component.ButtonComponent | ||
import com.bff.wespot.model.dynamicui.component.DynamicUiComponent | ||
import com.bff.wespot.model.dynamicui.component.ImageComponent | ||
import com.bff.wespot.model.dynamicui.component.TextComponent | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
sealed interface DynamicUiComponentDto | ||
|
||
fun DynamicUiComponentDto.toDynamicUiComponent(): DynamicUiComponent { | ||
return when (this) { | ||
is TextComponentDto -> TextComponent(text) | ||
is ImageComponentDto -> ImageComponent(url, width, height) | ||
is ButtonComponentDto -> ButtonComponent(text, link) | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...src/main/kotlin/com/bff/wespot/data/remote/model/dynamicui/component/ImageComponentDto.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.bff.wespot.data.remote.model.dynamicui.component | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
@SerialName("imageComponent") | ||
data class ImageComponentDto( | ||
val url: String, | ||
val width: Int, | ||
val height: Int | ||
): DynamicUiComponentDto |
10 changes: 10 additions & 0 deletions
10
.../src/main/kotlin/com/bff/wespot/data/remote/model/dynamicui/component/TextComponentDto.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.bff.wespot.data.remote.model.dynamicui.component | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
@SerialName("textComponent") | ||
data class TextComponentDto( | ||
val text: String, | ||
): DynamicUiComponentDto |