Skip to content

Commit

Permalink
fix: pick detail field UNKNOWN to null (#106)
Browse files Browse the repository at this point in the history
pickId, pickerId, pickerGender, pickerPlatform, pickerSecondInitialName, pickerFullName
  • Loading branch information
toychip authored Aug 17, 2024
1 parent 5b2ec83 commit e7df8a7
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 20 deletions.
7 changes: 5 additions & 2 deletions api/src/main/kotlin/com/mashup/dojo/PickController.kt
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,14 @@ class PickController(

val pickDetails =
pickDetailPaging.picks.map {
val pickId = if (it.pickId.value == "UNKNOWN") null else it.pickId
val pickerId = if (it.pickerId.value == "UNKNOWN") null else it.pickId

ReceivedPickDetail(
pickId = it.pickId,
pickId = pickId,
pickerOrdinal = it.pickerOrdinal,
pickerIdOpen = it.pickerIdOpen,
pickerId = it.pickerId,
pickerId = pickerId,
pickerGenderOpen = it.pickerGenderOpen,
pickerGender = it.pickerGender,
pickerPlatformOpen = it.pickerPlatformOpen,
Expand Down
12 changes: 6 additions & 6 deletions api/src/main/kotlin/com/mashup/dojo/dto/PickDto.kt
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,18 @@ data class PickDetailPaging(
)

data class ReceivedPickDetail(
val pickId: PickId,
val pickId: PickId?,
val pickerOrdinal: Int,
val pickerIdOpen: Boolean,
val pickerId: MemberId,
val pickerId: PickId?,
val pickerGenderOpen: Boolean,
val pickerGender: MemberGender,
val pickerGender: MemberGender?,
val pickerPlatformOpen: Boolean,
val pickerPlatform: MemberPlatform,
val pickerPlatform: MemberPlatform?,
val pickerSecondInitialNameOpen: Boolean,
val pickerSecondInitialName: String,
val pickerSecondInitialName: String?,
val pickerFullNameOpen: Boolean,
val pickerFullName: String,
val pickerFullName: String?,
val latestPickedAt: LocalDateTime,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,13 @@ interface PickService {
val pickerIdOpen: Boolean,
val pickerId: MemberId,
val pickerGenderOpen: Boolean,
val pickerGender: MemberGender,
val pickerGender: MemberGender?,
val pickerPlatformOpen: Boolean,
val pickerPlatform: MemberPlatform,
val pickerPlatform: MemberPlatform?,
val pickerSecondInitialNameOpen: Boolean,
val pickerSecondInitialName: String,
val pickerSecondInitialName: String?,
val pickerFullNameOpen: Boolean,
val pickerFullName: String,
val pickerFullName: String?,
val latestPickedAt: LocalDateTime,
)

Expand Down Expand Up @@ -288,41 +288,41 @@ class DefaultPickService(
fun transformPickerGender(
isOpen: Boolean,
pickerGender: MemberGender,
): MemberGender {
): MemberGender? {
if (isOpen) {
return pickerGender
}
return MemberGender.UNKNOWN
return null
}

fun transformPickerPlatform(
isOpen: Boolean,
pickerPlatform: MemberPlatform,
): MemberPlatform {
): MemberPlatform? {
if (isOpen) {
return pickerPlatform
}
return MemberPlatform.UNKNOWN
return null
}

fun transformPickerSecondInitialName(
isOpen: Boolean,
secondInitialName: String,
): String {
): String? {
if (isOpen) {
return secondInitialName
}
return UNKNOWN
return null
}

fun transformPickerFullName(
isOpen: Boolean,
fullName: String,
): String {
): String? {
if (isOpen) {
return fullName
}
return UNKNOWN
return null
}

override fun getPickCount(
Expand Down

0 comments on commit e7df8a7

Please sign in to comment.