Skip to content

Commit

Permalink
#271 불필요한 난이도 속성 제거
Browse files Browse the repository at this point in the history
  • Loading branch information
wisemuji committed May 8, 2024
1 parent 09b62c7 commit f0faf1e
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 42 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ internal data class SessionResponse(
val title: String,
val content: String,
val speakers: List<SpeakerResponse>,
val level: LevelResponse,
val tags: List<String>,
val room: RoomResponse?,
val startTime: LocalDateTime,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package com.droidknights.app.core.data.mapper

import com.droidknights.app.core.data.api.model.LevelResponse
import com.droidknights.app.core.data.api.model.RoomResponse
import com.droidknights.app.core.data.api.model.SessionResponse
import com.droidknights.app.core.data.api.model.SpeakerResponse
import com.droidknights.app.core.model.Level
import com.droidknights.app.core.model.Room
import com.droidknights.app.core.model.Session
import com.droidknights.app.core.model.Speaker
Expand All @@ -15,21 +13,13 @@ internal fun SessionResponse.toData(): Session = Session(
title = this.title,
content = this.content,
speakers = this.speakers.map { it.toData() },
level = this.level.toData(),
tags = this.tags.map { Tag(it) },
room = this.room?.toData() ?: Room.ETC,
startTime = this.startTime,
endTime = this.endTime,
isBookmarked = false
)

internal fun LevelResponse.toData(): Level = when (this) {
LevelResponse.ETC -> Level.ETC
LevelResponse.BASIC -> Level.BASIC
LevelResponse.INTERMEDIATE -> Level.INTERMEDIATE
LevelResponse.ADVANCED -> Level.ADVANCED
}

internal fun RoomResponse.toData(): Room = when (this) {
RoomResponse.ETC -> Room.ETC
RoomResponse.TRACK1 -> Room.TRACK1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ internal class DefaultSessionRepositoryTest : StringSpec() {
"역직렬화 테스트" {
val expected = Session(
id = "1",
title = "Keynote",
title = "키노트",
content = "",
speakers = emptyList(),
level = Level.ETC,
tags = emptyList(),
room = Room.ETC,
startTime = LocalDateTime(2023, 9, 12, 10, 45),
endTime = LocalDateTime(2023, 9, 12, 11, 0),
startTime = LocalDateTime(2024, 6, 11, 10, 40),
endTime = LocalDateTime(2024, 6, 11, 11, 0),
isBookmarked = false
)
val actual = repository.getSessions()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ data class Session(
val title: String,
val content: String,
val speakers: List<Speaker>,
val level: Level,
val tags: List<Tag>,
val room: Room,
val startTime: LocalDateTime,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import com.droidknights.app.core.designsystem.component.TextChip
import com.droidknights.app.core.designsystem.theme.DarkGray
import com.droidknights.app.core.designsystem.theme.KnightsTheme
import com.droidknights.app.core.designsystem.theme.LightGray
import com.droidknights.app.core.model.Level
import com.droidknights.app.core.model.Room
import com.droidknights.app.core.model.Session
import com.droidknights.app.core.model.Speaker
Expand Down Expand Up @@ -204,7 +203,6 @@ private fun SessionCardPreview() {
imageUrl = "https://picsum.photos/200",
),
),
level = Level.BASIC,
tags = listOf(
Tag("효율적인 코드베이스")
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ import com.droidknights.app.core.designsystem.component.TopAppBarNavigationType
import com.droidknights.app.core.designsystem.theme.DarkGray
import com.droidknights.app.core.designsystem.theme.KnightsTheme
import com.droidknights.app.core.designsystem.theme.LightGray
import com.droidknights.app.core.model.Level
import com.droidknights.app.core.model.Room
import com.droidknights.app.core.model.Session
import com.droidknights.app.core.model.Speaker
Expand Down Expand Up @@ -284,7 +283,6 @@ private val SampleSessionHasContent = Session(
imageUrl = "",
),
),
level = Level.ADVANCED,
tags = listOf(Tag("Dev Environment")),
room = Room.TRACK1,
startTime = LocalDateTime.parse("2023-09-12T11:00:00.000"),
Expand All @@ -303,7 +301,6 @@ private val SampleSessionNoContent = Session(
imageUrl = "",
),
),
level = Level.ADVANCED,
tags = listOf(Tag("Dev Environment")),
room = Room.TRACK1,
startTime = LocalDateTime.parse("2023-09-12T11:00:00.000"),
Expand Down

0 comments on commit f0faf1e

Please sign in to comment.