Skip to content

Commit c012c78

Browse files
committed
[BOOK-490] fix: representativeEmotion nullable로 변경
책만 등록하고 기록을 안 할 경우, 대표 감정은 null로 내려옴
1 parent 0575085 commit c012c78

6 files changed

Lines changed: 6 additions & 6 deletions

File tree

core/data/impl/src/main/kotlin/com/ninecraft/booket/core/data/impl/mapper/ResponseToModel.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ internal fun DetailEmotion.toModel(): DetailEmotionModel {
214214

215215
internal fun ReadingRecordsResponse.toModel(): ReadingRecordsModel {
216216
return ReadingRecordsModel(
217-
representativeEmotion = representativeEmotion.toModel(),
217+
representativeEmotion = representativeEmotion?.toModel(),
218218
lastPage = lastPage,
219219
totalResults = totalResults,
220220
startIndex = startIndex,

core/model/src/main/kotlin/com/ninecraft/booket/core/model/ReadingRecordsModel.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import androidx.compose.runtime.Immutable
44

55
@Immutable
66
data class ReadingRecordsModel(
7-
val representativeEmotion: PrimaryEmotionModel = PrimaryEmotionModel(),
7+
val representativeEmotion: PrimaryEmotionModel? = null,
88
val lastPage: Boolean = true,
99
val totalResults: Int = 0,
1010
val startIndex: Int = 0,

core/network/src/main/kotlin/com/ninecraft/booket/core/network/response/ReadingRecordsResponse.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import kotlinx.serialization.Serializable
66
@Serializable
77
data class ReadingRecordsResponse(
88
@SerialName("representativeEmotion")
9-
val representativeEmotion: PrimaryEmotion,
9+
val representativeEmotion: PrimaryEmotion?,
1010
@SerialName("lastPage")
1111
val lastPage: Boolean,
1212
@SerialName("totalResults")

feature/detail/src/main/kotlin/com/ninecraft/booket/feature/detail/book/BookDetailPresenter.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class BookDetailPresenter(
8181
var uiState by rememberRetained { mutableStateOf<UiState>(UiState.Idle) }
8282
var footerState by rememberRetained { mutableStateOf<FooterState>(FooterState.Idle) }
8383
var bookDetail by rememberRetained { mutableStateOf(BookDetailModel()) }
84-
var representativeEmotion by rememberRetained { mutableStateOf(PrimaryEmotionModel()) }
84+
var representativeEmotion by rememberRetained { mutableStateOf<PrimaryEmotionModel?>(null) }
8585
var seedsStates by rememberRetained { mutableStateOf<ImmutableList<EmotionModel>>(persistentListOf()) }
8686
var isStatsExpanded by rememberRetained { mutableStateOf(false) }
8787
var readingRecords by rememberRetained { mutableStateOf(persistentListOf<ReadingRecordModel>()) }

feature/detail/src/main/kotlin/com/ninecraft/booket/feature/detail/book/BookDetailUi.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ internal fun BookDetailContent(
286286
if (state.hasEmotionData()) {
287287
CollectedSeeds(
288288
seedsStats = state.seedsStats,
289-
representativeEmotion = state.representativeEmotion,
289+
representativeEmotion = state.representativeEmotion!!,
290290
isStatsExpanded = state.isStatsExpanded,
291291
onToggleClick = {
292292
state.eventSink(BookDetailUiEvent.OnStatsToggleClick(!state.isStatsExpanded))

feature/detail/src/main/kotlin/com/ninecraft/booket/feature/detail/book/BookDetailUiState.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ data class BookDetailUiState(
2727
val footerState: FooterState = FooterState.Idle,
2828
val isLoading: Boolean = false,
2929
val bookDetail: BookDetailModel = BookDetailModel(),
30-
val representativeEmotion: PrimaryEmotionModel = PrimaryEmotionModel(),
30+
val representativeEmotion: PrimaryEmotionModel? = null,
3131
val seedsStats: ImmutableList<EmotionModel> = persistentListOf(),
3232
val isStatsExpanded: Boolean = false,
3333
val readingRecords: ImmutableList<ReadingRecordModel> = persistentListOf(),

0 commit comments

Comments
 (0)