Skip to content

Commit

Permalink
feat: 배경조회시 어떠한 배경도 없다면, WHITE필드를 응답한다
Browse files Browse the repository at this point in the history
  • Loading branch information
devxb committed Oct 28, 2024
1 parent 46458ef commit b7e5177
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.gitanimals.render.controller.response

import org.gitanimals.render.domain.FieldType
import org.gitanimals.render.domain.User

data class BackgroundResponse(
Expand All @@ -9,15 +10,17 @@ data class BackgroundResponse(
) {

data class Background(
val type: String,
val type: FieldType,
)

companion object {
fun from(user: User): BackgroundResponse {
return BackgroundResponse(
id = user.id.toString(),
name = user.name,
backgrounds = user.fields.map { Background(it.fieldType.toString()) },
backgrounds = user.fields.map { Background(it.fieldType) }.ifEmpty {
listOf(Background(FieldType.WHITE_FIELD))
},
)
}
}
Expand Down

0 comments on commit b7e5177

Please sign in to comment.