-
Notifications
You must be signed in to change notification settings - Fork 0
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
fix : 요청시 지역 타입 변경 #13
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -111,13 +111,13 @@ private BooleanExpression genderSpecifier(List<TeacherGender> genders) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
.orElse(TRUE); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
private BooleanExpression districtSpecifier(List<District> districts) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
private BooleanExpression districtSpecifier(List<String> districts) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (districts == null || districts.isEmpty()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return TRUE; // where() 절에서 무시됨 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return districts.stream() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
.map(teacherDistrict.district::eq) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
.map(district -> teacherDistrict.district.eq(District.fromString(district))) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
.reduce(BooleanExpression::or) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
.orElse(TRUE); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+114
to
123
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add error handling for invalid district strings. The current implementation might throw an exception if private BooleanExpression districtSpecifier(List<String> districts) {
if (districts == null || districts.isEmpty()) {
return TRUE;
}
return districts.stream()
- .map(district -> teacherDistrict.district.eq(District.fromString(district)))
+ .map(district -> {
+ try {
+ return teacherDistrict.district.eq(District.fromString(district));
+ } catch (IllegalArgumentException e) {
+ // Log the error
+ return TRUE;
+ }
+ })
.reduce(BooleanExpression::or)
.orElse(TRUE);
} 📝 Committable suggestion
Suggested change
💡 Verification agent 🧩 Analysis chainImplement special handling for "경기도" regions. According to the PR objectives, special handling for "경기도" regions should be implemented. Consider adding logic to handle Gyeonggi-do districts: private BooleanExpression districtSpecifier(List<String> districts) {
if (districts == null || districts.isEmpty()) {
return TRUE;
}
return districts.stream()
- .map(district -> teacherDistrict.district.eq(District.fromString(district)))
+ .map(district -> {
+ if (district.contains("경기도")) {
+ // Handle Gyeonggi-do districts
+ return teacherDistrict.district.stringValue().like("경기도%");
+ }
+ return teacherDistrict.district.eq(District.fromString(district));
+ })
.reduce(BooleanExpression::or)
.orElse(TRUE);
} Let's verify if there are any existing Gyeonggi-do district handling patterns in the codebase: 🏁 Script executed: #!/bin/bash
# Search for existing Gyeonggi-do handling patterns
rg -i "경기도" --type java Length of output: 362 Special handling for "경기도" districts is missing. The search output only shows hardcoded district constants (e.g., "경기도 안양", "경기도 용인", "경기도 고양") in the
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
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.
💡 Verification agent
🧩 Analysis chain
Add validation for district strings.
The method accepts raw strings without validating if they represent valid districts. Consider adding validation to ensure the strings match valid district values.
🏁 Script executed:
Length of output: 84
🏁 Script executed:
Length of output: 1764
District String Validation Needed in Mapping Method
The
District
enum provides afromString
method for validating district strings. However, themapToAllFilteringTeacherResponse
method inAdminMapper.java
still accepts aList<String>
without converting or validating the district strings. Consider updating the mapper to invokeDistrict.fromString
for each supplied string to ensure only valid districts are used or to explicitly handle invalid input.src/main/java/com/yedu/backend/admin/application/mapper/AdminMapper.java
mapToAllFilteringTeacherResponse
to iterate over the provided strings, validate each usingDistrict.fromString
, and then use the resultingDistrict
value in the response.