Skip to content

Conversation

@HyemIin
Copy link
Member

@HyemIin HyemIin commented Jul 25, 2025

작업 요약

  • storeImageUrl 추가
  • 학과명 추가

Issue Link

문제점 및 어려움

해결 방안

Reference

Summary by CodeRabbit

  • 신규 기능

    • 매장 대기 정보에 배너 이미지 URL과 부서명이 추가되어, 관련 정보를 더 풍부하게 확인할 수 있습니다.
  • 버그 수정

    • 일부 메뉴 관련 API가 인증 없이 접근 가능하도록 공개 엔드포인트가 확장되었습니다.
  • 기타 개선

    • 매장 대기 순위 조회 시 배너 이미지와 부서명이 함께 제공되어 사용자 경험이 향상되었습니다.

- storeImageUrl 추가
- 학과명 추가
@HyemIin HyemIin self-assigned this Jul 25, 2025
@coderabbitai
Copy link

coderabbitai bot commented Jul 25, 2025

Walkthrough

보안 설정에서 새로운 URL 패턴이 인증 없이 접근 가능하도록 추가되었습니다. StoreWaitingInfo DTO에 bannerImageUrldepartmentName 필드가 추가되었고, 서비스 구현에서는 대기 중인 매장 정보에 배너 이미지 URL과 부서명을 포함하도록 확장되었습니다. 또한, StoreImageRepository에 매장과 이미지 타입으로 조회하는 메서드가 추가되었습니다.

Changes

파일/경로 변경 요약
.../config/security/SecurityConfig.java 인증 없이 허용되는 URL 패턴에 /v1/menus//all-menus/stores/** 추가
.../store/dto/StoreWaitingInfo.java bannerImageUrl, departmentName 필드 및 Swagger 주석 추가
.../store/service/StoreServiceImpl.java 매장 대기 정보에 배너 이미지 URL, 부서명 포함 로직 추가
.../store/repository/StoreImageRepository.java findByStoreAndImageType(Store, ImageType) 메서드 추가

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant StoreServiceImpl
    participant Redis
    participant StoreRepository
    participant DepartmentRepository
    participant StoreImageRepository

    Client->>StoreServiceImpl: getStoresByWaitingCount(desc)
    StoreServiceImpl->>Redis: scan for store waiting keys
    loop for each storeId
        StoreServiceImpl->>StoreRepository: findById(storeId)
        StoreServiceImpl->>DepartmentRepository: findById(store.departmentId)
        StoreServiceImpl->>StoreImageRepository: findByStoreAndImageType(store, BANNER)
    end
    StoreServiceImpl-->>Client: List<StoreWaitingInfo> (포함: bannerImageUrl, departmentName)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15 minutes

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/#158_Store예약많은순반환타입개선

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot requested a review from Jjiggu July 25, 2025 06:31
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
nowait-domain/domain-core-rdb/src/main/java/com/nowait/domaincorerdb/store/repository/StoreImageRepository.java (1)

3-3: 불필요한 static import 제거 권장

현재 파일에서 ImageType.*의 static import를 사용하지 않고 있습니다.

-import static com.nowait.domaincorerdb.store.entity.ImageType.*;
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 02514b7 and 94f0f2b.

📒 Files selected for processing (4)
  • nowait-app-user-api/src/main/java/com/nowait/applicationuser/config/security/SecurityConfig.java (1 hunks)
  • nowait-app-user-api/src/main/java/com/nowait/applicationuser/store/dto/StoreWaitingInfo.java (1 hunks)
  • nowait-app-user-api/src/main/java/com/nowait/applicationuser/store/service/StoreServiceImpl.java (2 hunks)
  • nowait-domain/domain-core-rdb/src/main/java/com/nowait/domaincorerdb/store/repository/StoreImageRepository.java (2 hunks)
🔇 Additional comments (3)
nowait-domain/domain-core-rdb/src/main/java/com/nowait/domaincorerdb/store/repository/StoreImageRepository.java (1)

24-24: 새로운 리포지토리 메서드 승인

Store 엔티티와 ImageType을 직접 받는 새로운 메서드가 추가되어 기존 메서드들과 일관성을 유지하며 사용성을 개선합니다.

nowait-app-user-api/src/main/java/com/nowait/applicationuser/store/dto/StoreWaitingInfo.java (1)

11-15: 생성자 인자 순서 확인 완료 및 코드 변경 승인

  • StoreWaitingInfo 클래스 필드 선언 순서
    (bannerImageUrl → departmentName → storeId → storeName → waitingCount)
    와 생성자 호출 인자 순서
    (imageUrl, department.getName(), storeId, storeName, count != null ? count : 0)
    가 일치함을 확인했습니다.
nowait-app-user-api/src/main/java/com/nowait/applicationuser/store/service/StoreServiceImpl.java (1)

29-29: Import 추가 승인

ImageType 사용을 위한 적절한 import 추가입니다.

"/webjars/**",
"/demo-ui.html"
"/demo-ui.html",
"/v1/menus//all-menus/stores/**"
Copy link

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:

#!/bin/bash
# 실제 메뉴 관련 엔드포인트 패턴 확인
ast-grep --pattern '@RequestMapping($$$)' | grep -i menu
ast-grep --pattern '@GetMapping($$$)' | grep -i menu
rg -A 2 -B 2 "v1/menus.*all-menus.*stores"

Length of output: 1855


이중 슬래시 오타 수정 필요

보안 설정에서 등록한 패턴

"/v1/menus//all-menus/stores/**"

는 실제 컨트롤러의 엔드포인트

@RequestMapping("/v1/menus")
@GetMapping("/all-menus/stores/{storeId}")

가 제공하는 /v1/menus/all-menus/stores/{storeId} 경로와 매칭되지 않습니다.
결과적으로 해당 API가 인증 없이 접근 허용 목록에 들어가지 않아 의도와 다르게 인증이 요구될 수 있습니다.

수정 제안:

  • 파일: nowait-app-user-api/src/main/java/com/nowait/applicationuser/config/security/SecurityConfig.java
  • 줄 70
  • "/v1/menus//all-menus/stores/**"
  • "/v1/menus/all-menus/stores/**"

해당 패턴을 위와 같이 변경하여 실제 엔드포인트와 일치시키고, 의도한 대로 인증 없이 접근 가능하도록 해주세요.

<details>
<summary>🤖 Prompt for AI Agents</summary>

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.


</details>

<!-- fingerprinting:phantom:poseidon:panther -->

<!-- This is an auto-generated comment by CodeRabbit -->

Comment on lines +242 to +255
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
));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

성능 최적화 및 예외 처리 개선 필요

현재 구현에서 다음 문제점들이 있습니다:

  1. Store 엔티티를 두 번 조회하는 비효율성 (238라인과 242라인)
  2. getReferenceById 사용으로 인한 잠재적 LazyInitializationException
  3. Department가 존재하지 않을 경우의 예외 처리 부재

다음과 같이 리팩토링을 권장합니다:

-				// 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

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
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
));
🤖 Prompt for AI Agents
In
nowait-app-user-api/src/main/java/com/nowait/applicationuser/store/service/StoreServiceImpl.java
around lines 242 to 255, avoid fetching the Store entity twice by reusing the
initially retrieved Store object. Replace getReferenceById for Department with a
safe fetch method like findById to prevent LazyInitializationException, and add
proper exception handling if the Department is not found. This will optimize
performance and improve robustness by ensuring all entities are properly loaded
and exceptions are handled gracefully.

@HyemIin HyemIin merged commit 87cdf4f into develop Jul 25, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants