Skip to content

Commit

Permalink
fix: dto 소문자로 return하기 enum 함수로 넣어주기
Browse files Browse the repository at this point in the history
  • Loading branch information
skfotakf committed Feb 8, 2024
1 parent 3eae575 commit a520f57
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,8 @@ enum class LanguageType {
throw CserealException.Csereal400("해당하는 enum을 찾을 수 없습니다")
}
}

// dto로 통신할 때 소문자로 return
fun makeLowercase(languageType: LanguageType): String = languageType.toString().lowercase()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class AboutEntity(
@Enumerated(EnumType.STRING)
var postType: AboutPostType,
@Enumerated(EnumType.STRING)
var language: LanguageType,
var language: LanguageType = LanguageType.KO,
var name: String?,

@Column(columnDefinition = "mediumText")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.wafflestudio.csereal.core.about.dto

import com.fasterxml.jackson.annotation.JsonInclude
import com.wafflestudio.csereal.common.properties.LanguageType
import com.wafflestudio.csereal.core.about.database.AboutEntity
import com.wafflestudio.csereal.core.resource.attachment.dto.AttachmentResponse
import java.time.LocalDateTime
Expand All @@ -26,7 +27,7 @@ data class AboutDto(
): AboutDto = entity.run {
AboutDto(
id = this.id,
language = this.language.toString().lowercase(),
language = LanguageType.makeLowercase(this.language),
name = this.name,
description = this.description,
year = this.year,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.wafflestudio.csereal.core.about.dto

import com.fasterxml.jackson.annotation.JsonInclude
import com.wafflestudio.csereal.common.properties.LanguageType
import com.wafflestudio.csereal.core.about.database.AboutEntity

data class DirectionDto(
Expand All @@ -14,7 +15,7 @@ data class DirectionDto(
fun of(entity: AboutEntity): DirectionDto = entity.run {
DirectionDto(
id = this.id,
language = this.language.toString().lowercase(),
language = LanguageType.makeLowercase(this.language),
name = this.name!!,
description = this.description
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.wafflestudio.csereal.core.about.dto

import com.fasterxml.jackson.annotation.JsonInclude
import com.wafflestudio.csereal.common.properties.LanguageType
import com.wafflestudio.csereal.core.about.database.AboutEntity

data class FacilityDto(
Expand All @@ -15,7 +16,7 @@ data class FacilityDto(
fun of(entity: AboutEntity): FacilityDto = entity.run {
FacilityDto(
id = this.id,
language = this.language.toString().lowercase(),
language = LanguageType.makeLowercase(this.language),
name = this.name!!,
description = this.description,
locations = this.locations.map { it.name }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.wafflestudio.csereal.core.about.dto

import com.fasterxml.jackson.annotation.JsonInclude
import com.wafflestudio.csereal.common.properties.LanguageType
import com.wafflestudio.csereal.core.about.database.AboutEntity

data class StudentClubDto(
Expand All @@ -14,7 +15,7 @@ data class StudentClubDto(
fun of(entity: AboutEntity): StudentClubDto = entity.run {
StudentClubDto(
id = this.id,
language = this.language.toString().lowercase(),
language = LanguageType.makeLowercase(this.language),
name = this.name!!,
description = this.description
)
Expand Down

0 comments on commit a520f57

Please sign in to comment.