-
Notifications
You must be signed in to change notification settings - Fork 0
feat(Store): 예약 개수 정렬 로직 반환타입 추가 #159
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
The head ref may contain hidden characters: "feature/#158_Store\uC608\uC57D\uB9CE\uC740\uC21C\uBC18\uD658\uD0C0\uC785\uAC1C\uC120"
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 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -26,6 +26,7 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import com.nowait.applicationuser.store.dto.StoreWaitingInfo; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import com.nowait.domaincorerdb.department.entity.Department; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import com.nowait.domaincorerdb.department.repository.DepartmentRepository; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import com.nowait.domaincorerdb.store.entity.ImageType; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import com.nowait.domaincorerdb.store.entity.Store; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import com.nowait.domaincorerdb.store.entity.StoreImage; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import com.nowait.domaincorerdb.store.exception.StoreNotFoundException; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -238,7 +239,20 @@ public List<StoreWaitingInfo> getStoresByWaitingCount(boolean desc) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .map(Store::getName) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .orElse(UNKNOWN_STORE_NAME); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| result.add(new StoreWaitingInfo(storeId, storeName, count != null ? count : 0)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Store store = storeRepository.findById(Long.valueOf(storeId)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .orElseThrow(StoreNotFoundException::new); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Department department = departmentRepository.getReferenceById(store.getDepartmentId()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| List<StoreImage> storeImageList = storeImageRepository.findByStoreAndImageType(store, ImageType.BANNER); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| String imageUrl = storeImageList.isEmpty() ? null : storeImageList.get(0).getImageUrl(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| result.add(new StoreWaitingInfo( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| imageUrl, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| department.getName(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| storeId, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| storeName, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| count != null ? count : 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| )); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+242
to
+255
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. 🛠️ Refactor suggestion 성능 최적화 및 예외 처리 개선 필요 현재 구현에서 다음 문제점들이 있습니다:
다음과 같이 리팩토링을 권장합니다: - // DB에서 storeName 조회
- String storeName = storeRepository.findById(Long.valueOf(storeId))
- .map(Store::getName)
- .orElse(UNKNOWN_STORE_NAME);
-
- Store store = storeRepository.findById(Long.valueOf(storeId))
- .orElseThrow(StoreNotFoundException::new);
- Department department = departmentRepository.getReferenceById(store.getDepartmentId());
- List<StoreImage> storeImageList = storeImageRepository.findByStoreAndImageType(store, ImageType.BANNER);
-
- String imageUrl = storeImageList.isEmpty() ? null : storeImageList.get(0).getImageUrl();
-
- result.add(new StoreWaitingInfo(
- imageUrl,
- department.getName(),
- storeId,
- storeName,
- count != null ? count : 0
- ));
+ Store store = storeRepository.findById(Long.valueOf(storeId))
+ .orElseThrow(StoreNotFoundException::new);
+
+ String departmentName = departmentRepository.findById(store.getDepartmentId())
+ .map(Department::getName)
+ .orElse("Unknown Department");
+
+ List<StoreImage> storeImageList = storeImageRepository.findByStoreAndImageType(store, ImageType.BANNER);
+ String imageUrl = storeImageList.isEmpty() ? null : storeImageList.get(0).getImageUrl();
+
+ result.add(new StoreWaitingInfo(
+ imageUrl,
+ departmentName,
+ storeId,
+ store.getName(),
+ count != null ? count : 0
+ ));📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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
URL 패턴의 이중 슬래시 검증 필요
URL 패턴에 이중 슬래시(
//)가 포함되어 있습니다. 이것이 의도된 것인지 확인이 필요합니다.다음 스크립트로 실제 컨트롤러 엔드포인트와 일치하는지 확인해주세요:
🏁 Script executed:
Length of output: 1855
이중 슬래시 오타 수정 필요
보안 설정에서 등록한 패턴
"/v1/menus//all-menus/stores/**"는 실제 컨트롤러의 엔드포인트
가 제공하는
/v1/menus/all-menus/stores/{storeId}경로와 매칭되지 않습니다.결과적으로 해당 API가 인증 없이 접근 허용 목록에 들어가지 않아 의도와 다르게 인증이 요구될 수 있습니다.
수정 제안:
In
nowait-app-user-api/src/main/java/com/nowait/applicationuser/config/security/SecurityConfig.java
at line 70, fix the double slash typo in the URL pattern
"/v1/menus//all-menus/stores/" by changing it to
"/v1/menus/all-menus/stores/" so it correctly matches the controller endpoint
and allows unauthenticated access as intended.