Skip to content

Commit d128a6e

Browse files
committed
[fix] rawValue 값 변환 실패 버그 수정
1 parent 7d298b6 commit d128a6e

2 files changed

Lines changed: 15 additions & 5 deletions

File tree

Projects/Domain/Sources/DTO/Category/CategoryListInquiryResponse+Extention.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public extension CategoryItemInquiryResponse {
3232
contentCount: self.contentCount,
3333
createdAt: self.createdAt,
3434
openType: BaseOpenType(rawValue: self.openType) ?? .비공개,
35-
keywordType: BaseInterestType(rawValue: self.keywordType) ?? .default,
35+
keywordType: BaseInterestType(rawValue: self.keywordType.slashConvertUnderBar) ?? .default,
3636
userCount: self.userCount
3737
)
3838
}

Projects/Util/Sources/BaseInterestType.swift

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// Created by 김민호 on 1/6/25.
66
//
77

8-
public enum BaseInterestType: String {
8+
public enum BaseInterestType: String, CaseIterable {
99
case `default`
1010
case 스포츠_레저
1111
case 문구_오피스
@@ -23,9 +23,19 @@ public enum BaseInterestType: String {
2323
case 취업정보
2424

2525
public var title: String {
26-
if self.rawValue.contains("_") {
27-
return self.rawValue.replacingOccurrences(of: "_", with: "/")
26+
switch self {
27+
case .경제_시사: return "경제/시사"
28+
case .스포츠_레저: return "스포츠/레저"
29+
case .영화_드라마: return "영화/드라마"
30+
case .문구_오피스: return "문구/오피스"
31+
32+
default: return self.rawValue
2833
}
29-
return self.rawValue
34+
}
35+
}
36+
37+
public extension String {
38+
var slashConvertUnderBar: String {
39+
return self.replacingOccurrences(of: "/", with: "_")
3040
}
3141
}

0 commit comments

Comments
 (0)