-
Notifications
You must be signed in to change notification settings - Fork 0
feat: 기록 상세 화면 감정 표시 개편 #275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| // Copyright © 2025 Booket. All rights reserved | ||
|
|
||
| import Foundation | ||
|
|
||
| enum EmotionAPI { | ||
| case fetchEmotions | ||
| } | ||
|
|
||
| extension EmotionAPI: RequestTarget { | ||
| var baseURL: String { | ||
| return "\(APIConfig.baseURLv2)/emotions" | ||
| } | ||
|
|
||
| var path: String { | ||
| switch self { | ||
| case .fetchEmotions: | ||
| return "" | ||
| } | ||
| } | ||
|
|
||
| var method: HTTPMethod { | ||
| switch self { | ||
| case .fetchEmotions: | ||
| return .get | ||
| } | ||
| } | ||
|
|
||
| var headers: [String: String] { | ||
| return [ | ||
| "Content-Type": "application/json" | ||
| ] | ||
| } | ||
|
|
||
| var body: Encodable? { | ||
| return nil | ||
| } | ||
|
|
||
| var query: [String: Any] { | ||
| return [:] | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
src/Projects/BKData/Sources/DTO/Response/EmotionResponseDTO.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| // Copyright © 2025 Booket. All rights reserved | ||
|
|
||
| import BKDomain | ||
| import Foundation | ||
|
|
||
| // MARK: - API Response DTO | ||
|
|
||
| struct EmotionListResponseDTO: Decodable { | ||
| let emotions: [EmotionGroupDTO] | ||
| } | ||
|
|
||
| struct EmotionGroupDTO: Decodable { | ||
| let code: String | ||
| let displayName: String | ||
| let detailEmotions: [DetailEmotionDTO] | ||
| } | ||
|
|
||
| struct DetailEmotionDTO: Decodable { | ||
| let id: String | ||
| let name: String | ||
| } | ||
|
|
||
| // MARK: - Mapping to Domain | ||
|
|
||
| extension EmotionGroupDTO { | ||
| func toDomain() -> EmotionGroup? { | ||
| guard let primaryEmotion = PrimaryEmotion(rawValue: code) else { | ||
| return nil | ||
| } | ||
| return EmotionGroup( | ||
| primaryEmotion: primaryEmotion, | ||
| displayName: displayName, | ||
| detailEmotions: detailEmotions.map { $0.toDomain() } | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| extension DetailEmotionDTO { | ||
| func toDomain() -> DetailEmotion { | ||
| return DetailEmotion(id: id, name: name) | ||
| } | ||
| } | ||
|
|
||
| // MARK: - Response에서 사용하는 DTO (기록 조회 시) | ||
|
|
||
| struct PrimaryEmotionDTO: Decodable { | ||
| let code: String | ||
| let displayName: String | ||
|
|
||
| func toDomain() -> PrimaryEmotion? { | ||
| return PrimaryEmotion(rawValue: code) | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PrimaryEmotionDTO.toDomain()의 fallback 처리 불일치PrimaryEmotionResponseDTO.swift의toDomain()은PrimaryEmotion(rawValue: code) ?? .other로 fallback을 제공하지만, 이 파일의PrimaryEmotionDTO.toDomain()은nil을 반환합니다. 같은 도메인 타입을 변환하는데 fallback 전략이 다르면 호출부에서 혼란이 생길 수 있습니다. 의도된 차이인지 확인해 주세요.🤖 Prompt for AI Agents