Skip to content

Conversation

@HyemIin
Copy link
Member

@HyemIin HyemIin commented Jul 1, 2025

작업 요약

  • APIAdmin,APIUser에 corsConfig 의존성 추가

Issue Link

#37

문제점 및 어려움

해결 방안

Reference

Summary by CodeRabbit

  • 신규 기능

    • 주문 생성 응답에 sessionId 정보가 추가되었습니다.
  • 버그 수정

    • 엔티티 스캔 패키지 중복 항목이 정리되었습니다.
  • 기타

    • CORS 허용 오리진에 "http://localhost:63342"가 추가되어 로컬 환경에서의 접근성이 향상되었습니다.
    • 내부 모듈 의존성 및 컴포넌트 스캔 범위가 확장되었습니다.

@HyemIin HyemIin self-assigned this Jul 1, 2025
@coderabbitai
Copy link

coderabbitai bot commented Jul 1, 2025

Walkthrough

application-adminapplication-user 모듈에 application-config 의존성이 추가되었습니다. 두 모듈의 Spring Boot 애플리케이션은 컴포넌트 스캔 범위에 com.nowait.config 패키지를 포함하도록 수정되었습니다. CORS 허용 오리진에 추가 포트가 등록되었으며, 주문 응답 DTO에 sessionId 필드가 새로 추가되었습니다.

Changes

파일/경로 변경 요약
application-admin/build.gradle,
application-user/build.gradle
:application-config 모듈 의존성 추가
application-admin/src/main/java/com/nowait/applicationadmin/ApiAdminApplication.java
application-user/src/main/java/com/nowait/applicationuser/ApiUserApplication.java
컴포넌트 스캔 패키지에 com.nowait.config 추가, 중복 엔티티 스캔 제거
application-config/src/main/java/com/nowait/config/config/CorsConfig.java CORS 허용 오리진에 "http://localhost:63342" 추가
application-user/src/main/java/com/nowait/applicationuser/order/dto/OrderCreateResponseDto.java sessionId 필드 및 매핑 로직 추가

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant ApiUserApplication
    participant CorsConfig
    participant OrderService
    participant OrderCreateResponseDto

    Client->>ApiUserApplication: 주문 생성 요청
    ApiUserApplication->>OrderService: 주문 처리
    OrderService-->>OrderCreateResponseDto: UserOrder 엔티티 전달
    OrderCreateResponseDto-->>OrderService: sessionId 포함 응답 DTO 생성
    OrderService-->>ApiUserApplication: 응답 DTO 반환
    ApiUserApplication-->>Client: sessionId 포함 응답 반환

    Note over ApiUserApplication, CorsConfig: CORS 허용 오리진에 63342 포트 추가 적용
Loading
✨ Finishing Touches
  • 📝 Generate Docstrings

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 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 1, 2025 07:24
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: 0

🧹 Nitpick comments (1)
application-config/src/main/java/com/nowait/config/config/CorsConfig.java (1)

18-18: CORS 허용 오리진이 적절히 추가되었습니다.

IntelliJ IDEA의 내장 웹 서버에서 사용하는 포트 63342가 허용 오리진에 추가되어 개발 환경에서의 CORS 문제가 해결됩니다.

개발 환경과 운영 환경을 구분하여 설정하는 것을 고려해보세요:

@Configuration
public class CorsConfig {
+   @Value("${cors.allowed-origins:http://localhost:5173,http://localhost:63342}")
+   private String allowedOrigins;
+
    @Bean
    public CorsConfigurationSource corsConfigurationSource() {
        CorsConfiguration config = new CorsConfiguration();
        config.setAllowCredentials(true);
-       config.setAllowedOrigins(List.of("http://localhost:5173","http://localhost:63342"));
+       config.setAllowedOrigins(Arrays.asList(allowedOrigins.split(",")));
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between cb60934 and 8760688.

📒 Files selected for processing (6)
  • application-admin/build.gradle (1 hunks)
  • application-admin/src/main/java/com/nowait/applicationadmin/ApiAdminApplication.java (1 hunks)
  • application-config/src/main/java/com/nowait/config/config/CorsConfig.java (1 hunks)
  • application-user/build.gradle (1 hunks)
  • application-user/src/main/java/com/nowait/applicationuser/ApiUserApplication.java (1 hunks)
  • application-user/src/main/java/com/nowait/applicationuser/order/dto/OrderCreateResponseDto.java (1 hunks)
🔇 Additional comments (6)
application-admin/build.gradle (1)

31-31: 의존성 추가가 올바르게 구현되었습니다.

:application-config 의존성이 다른 프로젝트 의존성들과 일관된 패턴으로 추가되었으며, CORS 설정을 공유하기 위한 PR 목적에 부합합니다.

application-user/build.gradle (1)

32-32: 의존성 추가가 일관되게 구현되었습니다.

application-admin 모듈과 동일한 방식으로 :application-config 의존성이 추가되어 일관성을 유지하고 있습니다.

application-admin/src/main/java/com/nowait/applicationadmin/ApiAdminApplication.java (1)

13-13: 컴포넌트 스캔 설정이 적절히 추가되었습니다.

com.nowait.config 패키지를 스캔 범위에 포함시켜 application-config 모듈의 설정 빈들이 정상적으로 감지될 수 있도록 했습니다.

application-user/src/main/java/com/nowait/applicationuser/ApiUserApplication.java (1)

14-14: 공유 설정을 위한 컴포넌트 스캔이 올바르게 추가되었습니다.

application-admin 모듈과 동일하게 com.nowait.config 패키지가 스캔 범위에 포함되어 CORS 설정이 두 애플리케이션에서 공통으로 사용될 수 있습니다.

application-user/src/main/java/com/nowait/applicationuser/order/dto/OrderCreateResponseDto.java (2)

18-18: 세션 ID 노출에 대한 보안 검토가 필요합니다.

응답 DTO에 sessionId를 포함하는 것이 보안상 적절한지 검토해주세요. 세션 ID가 클라이언트에 노출되면 세션 하이재킹 등의 보안 위험이 있을 수 있습니다. CORS 설정과 관련된 변경이라면 대안적인 방법(예: CSRF 토큰, 별도의 식별자 등)을 고려해보시기 바랍니다.


26-26: UserOrder.getSessionId() 메서드 존재 확인 및 null 처리 검토
Lombok의 @Getter 어노테이션이 26번 라인에 적용되어 있어 getSessionId()가 자동 생성되므로 호출이 정상 동작합니다.
필요 시 null 값에 대한 별도 처리가 필요하다면 다음을 고려하세요:

  • Optional 반환으로 변경
  • 빈 문자열 혹은 기본값 대입
  • 호출부에서 Objects.requireNonNullElse(order.getSessionId(), “”) 등 활용

• UserOrder.java (domain-order/src/main/java/com/nowait/order/entity/UserOrder.java)
– 26: @Getter
– 48: private String sessionId;

@HyemIin HyemIin merged commit df24b36 into develop Jul 1, 2025
2 checks passed
@HyemIin HyemIin deleted the refactor/#37-cors의존성추가 branch July 1, 2025 07:26
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