-
Notifications
You must be signed in to change notification settings - Fork 0
fix: 핀 조회 파라미터 복구 및 필터 파싱 재적용 #107
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
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
12 changes: 12 additions & 0 deletions
12
src/main/java/com/zimdugo/locker/application/filter/IndoorOutdoorFilterType.java
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,12 @@ | ||
| package com.zimdugo.locker.application.filter; | ||
|
|
||
| import com.zimdugo.locker.domain.locker.IndoorOutdoorType; | ||
|
|
||
| public enum IndoorOutdoorFilterType { | ||
| INDOOR, | ||
| OUTDOOR; | ||
|
|
||
| public IndoorOutdoorType toDomain() { | ||
| return IndoorOutdoorType.valueOf(name()); | ||
| } | ||
| } |
18 changes: 18 additions & 0 deletions
18
src/main/java/com/zimdugo/locker/application/filter/LockerFacilityFilterType.java
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,18 @@ | ||
| package com.zimdugo.locker.application.filter; | ||
|
|
||
| import com.zimdugo.locker.domain.locker.LockerType; | ||
|
|
||
| public enum LockerFacilityFilterType { | ||
| MUSEUM, | ||
| SUBWAY_STATION, | ||
| DEPARTMENT_STORE, | ||
| CONVENIENCE_STORE, | ||
| PUBLIC_OFFICE, | ||
| PRIVATE_LOCKER, | ||
| TRAIN_STATION, | ||
| ETC; | ||
|
|
||
| public LockerType toDomain() { | ||
| return LockerType.valueOf(name()); | ||
| } | ||
| } |
35 changes: 35 additions & 0 deletions
35
src/main/java/com/zimdugo/locker/application/filter/LockerSearchFilterFactory.java
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,35 @@ | ||
| package com.zimdugo.locker.application.filter; | ||
|
|
||
| import com.zimdugo.locker.domain.search.LockerSearchFilter; | ||
| import java.util.Set; | ||
| import java.util.stream.Collectors; | ||
|
|
||
| public final class LockerSearchFilterFactory { | ||
|
|
||
| private LockerSearchFilterFactory() { | ||
| } | ||
|
|
||
| public static LockerSearchFilter create( | ||
| Set<LockerSizeFilterType> sizeTypes, | ||
| Set<IndoorOutdoorFilterType> indoorOutdoorTypes, | ||
| Set<LockerFacilityFilterType> lockerTypes | ||
| ) { | ||
| return new LockerSearchFilter( | ||
| sizeTypes == null | ||
| ? Set.of() | ||
| : sizeTypes.stream() | ||
| .map(LockerSizeFilterType::toDomain) | ||
| .collect(Collectors.toUnmodifiableSet()), | ||
| indoorOutdoorTypes == null | ||
| ? Set.of() | ||
| : indoorOutdoorTypes.stream() | ||
| .map(IndoorOutdoorFilterType::toDomain) | ||
| .collect(Collectors.toUnmodifiableSet()), | ||
| lockerTypes == null | ||
| ? Set.of() | ||
| : lockerTypes.stream() | ||
| .map(LockerFacilityFilterType::toDomain) | ||
| .collect(Collectors.toUnmodifiableSet()) | ||
| ); | ||
| } | ||
| } | ||
13 changes: 13 additions & 0 deletions
13
src/main/java/com/zimdugo/locker/application/filter/LockerSizeFilterType.java
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 @@ | ||
| package com.zimdugo.locker.application.filter; | ||
|
|
||
| import com.zimdugo.locker.domain.locker.LockerSizeType; | ||
|
|
||
| public enum LockerSizeFilterType { | ||
| SMALL, | ||
| MEDIUM, | ||
| LARGE; | ||
|
|
||
| public LockerSizeType toDomain() { | ||
| return LockerSizeType.valueOf(name()); | ||
| } | ||
| } |
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
9 changes: 6 additions & 3 deletions
9
src/main/java/com/zimdugo/locker/application/place/PlaceLockerQueryCommand.java
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 |
|---|---|---|
| @@ -1,13 +1,16 @@ | ||
| package com.zimdugo.locker.application.place; | ||
|
|
||
| import com.zimdugo.locker.application.filter.IndoorOutdoorFilterType; | ||
| import com.zimdugo.locker.application.filter.LockerFacilityFilterType; | ||
| import com.zimdugo.locker.application.filter.LockerSizeFilterType; | ||
| import java.util.Set; | ||
|
|
||
| public record PlaceLockerQueryCommand( | ||
| Long placeId, | ||
| double latitude, | ||
| double longitude, | ||
| Set<String> sizeTypes, | ||
| Set<String> indoorOutdoorTypes, | ||
| Set<String> lockerTypes | ||
| Set<LockerSizeFilterType> sizeTypes, | ||
| Set<IndoorOutdoorFilterType> indoorOutdoorTypes, | ||
| Set<LockerFacilityFilterType> lockerTypes | ||
| ) { | ||
| } |
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
9 changes: 6 additions & 3 deletions
9
src/main/java/com/zimdugo/locker/application/search/LockerSearchCommand.java
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 |
|---|---|---|
| @@ -1,14 +1,17 @@ | ||
| package com.zimdugo.locker.application.search; | ||
|
|
||
| import com.zimdugo.locker.application.filter.IndoorOutdoorFilterType; | ||
| import com.zimdugo.locker.application.filter.LockerFacilityFilterType; | ||
| import com.zimdugo.locker.application.filter.LockerSizeFilterType; | ||
| import java.util.Set; | ||
|
|
||
| public record LockerSearchCommand( | ||
| double latitude, | ||
| double longitude, | ||
| String keyword, | ||
| Set<String> sizeTypes, | ||
| Set<String> indoorOutdoorTypes, | ||
| Set<String> lockerTypes, | ||
| Set<LockerSizeFilterType> sizeTypes, | ||
| Set<IndoorOutdoorFilterType> indoorOutdoorTypes, | ||
| Set<LockerFacilityFilterType> lockerTypes, | ||
| Double zoom | ||
| ) { | ||
| } |
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
19 changes: 19 additions & 0 deletions
19
src/main/java/com/zimdugo/locker/entrypoint/config/LockerRequestWebMvcConfig.java
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,19 @@ | ||
| package com.zimdugo.locker.entrypoint.config; | ||
|
|
||
| import com.zimdugo.locker.entrypoint.converter.IndoorOutdoorTypeRequestConverter; | ||
| import com.zimdugo.locker.entrypoint.converter.LockerSizeTypeRequestConverter; | ||
| import com.zimdugo.locker.entrypoint.converter.LockerTypeRequestConverter; | ||
| import org.springframework.context.annotation.Configuration; | ||
| import org.springframework.format.FormatterRegistry; | ||
| import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | ||
|
|
||
| @Configuration | ||
| public class LockerRequestWebMvcConfig implements WebMvcConfigurer { | ||
|
|
||
| @Override | ||
| public void addFormatters(FormatterRegistry registry) { | ||
| registry.addConverter(new LockerSizeTypeRequestConverter()); | ||
| registry.addConverter(new IndoorOutdoorTypeRequestConverter()); | ||
| registry.addConverter(new LockerTypeRequestConverter()); | ||
| } | ||
| } |
24 changes: 24 additions & 0 deletions
24
src/main/java/com/zimdugo/locker/entrypoint/converter/IndoorOutdoorTypeRequestConverter.java
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,24 @@ | ||
| package com.zimdugo.locker.entrypoint.converter; | ||
|
|
||
| import com.zimdugo.core.exception.BusinessException; | ||
| import com.zimdugo.core.exception.ErrorCode; | ||
| import com.zimdugo.locker.application.filter.IndoorOutdoorFilterType; | ||
| import java.util.Locale; | ||
| import org.springframework.core.convert.converter.Converter; | ||
|
|
||
| public class IndoorOutdoorTypeRequestConverter implements Converter<String, IndoorOutdoorFilterType> { | ||
|
|
||
| @Override | ||
| public IndoorOutdoorFilterType convert(String source) { | ||
| String normalized = LockerFilterRequestValueNormalizer.normalize(source); | ||
| if (normalized == null || normalized.isBlank()) { | ||
| return null; | ||
| } | ||
|
|
||
| try { | ||
| return IndoorOutdoorFilterType.valueOf(normalized.toUpperCase(Locale.ROOT)); | ||
| } catch (IllegalArgumentException e) { | ||
| throw new BusinessException(ErrorCode.INVALID_PARAMETER_FORMAT); | ||
| } | ||
| } | ||
| } |
14 changes: 14 additions & 0 deletions
14
...main/java/com/zimdugo/locker/entrypoint/converter/LockerFilterRequestValueNormalizer.java
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,14 @@ | ||
| package com.zimdugo.locker.entrypoint.converter; | ||
|
|
||
| final class LockerFilterRequestValueNormalizer { | ||
|
|
||
| private LockerFilterRequestValueNormalizer() { | ||
| } | ||
|
|
||
| static String normalize(String source) { | ||
| if (source == null) { | ||
| return null; | ||
| } | ||
| return source.replaceAll("[\\[\\]\"]", "").trim(); | ||
| } | ||
| } |
24 changes: 24 additions & 0 deletions
24
src/main/java/com/zimdugo/locker/entrypoint/converter/LockerSizeTypeRequestConverter.java
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,24 @@ | ||
| package com.zimdugo.locker.entrypoint.converter; | ||
|
|
||
| import com.zimdugo.core.exception.BusinessException; | ||
| import com.zimdugo.core.exception.ErrorCode; | ||
| import com.zimdugo.locker.application.filter.LockerSizeFilterType; | ||
| import java.util.Locale; | ||
| import org.springframework.core.convert.converter.Converter; | ||
|
|
||
| public class LockerSizeTypeRequestConverter implements Converter<String, LockerSizeFilterType> { | ||
|
|
||
| @Override | ||
| public LockerSizeFilterType convert(String source) { | ||
| String normalized = LockerFilterRequestValueNormalizer.normalize(source); | ||
| if (normalized == null || normalized.isBlank()) { | ||
| return null; | ||
| } | ||
|
|
||
| try { | ||
| return LockerSizeFilterType.valueOf(normalized.toUpperCase(Locale.ROOT)); | ||
| } catch (IllegalArgumentException e) { | ||
| throw new BusinessException(ErrorCode.INVALID_LOCKER_SIZE_TYPE); | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
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.