-
Notifications
You must be signed in to change notification settings - Fork 0
아이템 필터 적용 #268
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
아이템 필터 적용 #268
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
0123f21
Merge branch 'feat/suggest' into feat/#260-SearchAPI
duthd3 6fe873e
itemFilter
duthd3 ddeb884
itemFilterDemo
duthd3 14458c7
bookmark dependency inject
duthd3 b88ddcb
feat/#266-ItemFilter
duthd3 5672a9e
Merge branch 'dev' into feat/#266-ItemFilter
duthd3 31d25a7
style/#266: Apply SwiftLint autocorrect
github-actions[bot] 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
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
57 changes: 57 additions & 0 deletions
57
MLS/Domain/Domain/UseCaseImpl/DictionaryList/ParseItemFilterResultUseCaseImpl.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,57 @@ | ||
| import DomainInterface | ||
|
|
||
| public final class ParseItemFilterResultUseCaseImpl: ParseItemFilterResultUseCase { | ||
|
|
||
| private let jobIdMap: [String: Int] = [ | ||
| "전사": 100, "마법사": 200, "도적": 400, "궁수": 300 | ||
| ] | ||
| private let categoryIdMap: [String: Int] = [ | ||
| "한손검": 7, "한손도끼": 8, "한손둔기": 9, "단검": 10, "완드": 12, | ||
| "스태프": 13, "두손검": 14, "두손도끼": 15, "두손둔기": 16, "창": 17, | ||
| "폴암": 18, "활": 19, "석궁": 20, "아대": 21, "모자": 24, "상의": 25, | ||
| "하의": 26, "전신갑옷": 27, "신발": 28, "장갑": 29, "방패": 31, "망토": 30, | ||
| "얼굴장식": 32, "눈장식": 33, "귀고리": 34, "반지": 35, "펜던트": 36, | ||
| "벨트": 37, "어깨장식": 38, "화살": 81, "표창": 83, | ||
| "한손검주문서": 50, "한손도끼주문서": 51, "한손둔기주문서": 52, | ||
| "단검주문서": 53, "완드주문서": 55, "스태프주문서": 56, "두손검주문서": 57, | ||
| "두손도끼주문서": 58, "두손둔기주문서": 59, "창주문서": 60, "폴암주문서": 61, | ||
| "활주문서": 62, "석궁주문서": 63, "아대주문서": 64, "투구주문서": 67, "상의주문서": 68, "하의주문서": 69, "전신갑옷주문서": 70, "신발주문서": 71, "장갑주문서": 72, "망토주문서": 73, "방패주문서": 74, | ||
| "귀장식주문서": 78, "펫장비주문서": 75, "연성서주문서": 76, "귀환주문서": 77, | ||
| "마스터리북": 42, "스킬북": 43, "소비": 44, "설치": 45, "이동수단": 46 | ||
| ] | ||
|
|
||
| public init() {} | ||
|
|
||
| public func execute(results: [(String, String)]) -> ItemFilterCriteria { | ||
| let initialCriteria = (jobIds: [Int](), startLevel: Int?(nil), endLevel: Int?(nil), categoryIds: [Int]()) | ||
|
|
||
| let finalCriteria = results.reduce(into: initialCriteria) { criteria, result in | ||
| let (key, value) = result | ||
| switch key { | ||
| case "직업": | ||
| if let id = jobIdMap[value] { | ||
| criteria.jobIds.append(id) | ||
| } | ||
| case "레벨": | ||
| let levelText = value.replacingOccurrences(of: "레벨", with: "").trimmingCharacters(in: .whitespaces) | ||
| let parts = levelText.split(separator: "~").map { $0.trimmingCharacters(in: .whitespaces) } | ||
| if let low = Int(parts.first ?? ""), let high = Int(parts.last ?? "") { | ||
| criteria.startLevel = low | ||
| criteria.endLevel = high | ||
| } | ||
| case "무기", "발사체", "방어구", "장신구", "기타아이템": | ||
| if let id = categoryIdMap[value] { | ||
| criteria.categoryIds.append(id) | ||
| } | ||
| case "무기주문서", "방어구주문서", "기타주문서": | ||
| if let id = categoryIdMap[value + "주문서"] { | ||
| criteria.categoryIds.append(id) | ||
| } | ||
| default: | ||
| break | ||
| } | ||
| } | ||
|
|
||
| return ItemFilterCriteria(jobIds: finalCriteria.jobIds, startLevel: finalCriteria.startLevel, endLevel: finalCriteria.endLevel, categoryIds: finalCriteria.categoryIds) | ||
| } | ||
| } | ||
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
13 changes: 13 additions & 0 deletions
13
MLS/Domain/DomainInterface/Entity/DictionaryList/ItemFilterCriteria.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,13 @@ | ||
| public struct ItemFilterCriteria { | ||
| public let jobIds: [Int] | ||
| public let startLevel: Int? | ||
| public let endLevel: Int? | ||
| public let categoryIds: [Int] | ||
|
|
||
| public init(jobIds: [Int], startLevel: Int?, endLevel: Int?, categoryIds: [Int]) { | ||
| self.jobIds = jobIds | ||
| self.startLevel = startLevel | ||
| self.endLevel = endLevel | ||
| self.categoryIds = categoryIds | ||
| } | ||
| } |
2 changes: 1 addition & 1 deletion
2
MLS/Domain/DomainInterface/Entity/SearchCount/SearchCountResponse.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
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
3 changes: 3 additions & 0 deletions
3
MLS/Domain/DomainInterface/UseCase/DictionaryList/ParseItemFilterUseCase.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,3 @@ | ||
| public protocol ParseItemFilterResultUseCase { | ||
| func execute(results: [(String, String)]) -> ItemFilterCriteria | ||
| } |
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.
Uh oh!
There was an error while loading. Please reload this page.