Skip to content

Conversation

@HyemIin
Copy link
Member

@HyemIin HyemIin commented Jun 17, 2025

작업 요약

  • 각 컨트롤러에 swagger 어노테이션 등록

Issue Link

#28

문제점 및 어려움

해결 방안

Reference

Summary by CodeRabbit

  • Documentation

    • 메뉴, 메뉴 이미지, 주점, 주점 이미지 관련 API에 OpenAPI(Swagger) 문서화 주석이 추가되어 API 사용법이 더욱 명확해졌습니다.
  • Bug Fixes

    • 즐겨찾기 생성 엔드포인트의 URL 경로가 "/create/{storeId}"로 변경되었습니다.
  • Chores

    • 보안 설정이 변경되어, 이제 "/admin"으로 시작하는 경로만 비인증 접근이 허용됩니다. 기존의 공개 엔드포인트 일부가 인증 필요로 변경되었습니다.

- 각 컨트롤러에 swagger 어노테이션 등록
@HyemIin HyemIin self-assigned this Jun 17, 2025
@coderabbitai
Copy link

coderabbitai bot commented Jun 17, 2025

Walkthrough

이번 변경에서는 여러 컨트롤러 클래스에 OpenAPI(Swagger) 어노테이션이 추가되어 API 문서화가 강화되었으며, 일부 엔드포인트의 URL 경로와 보안 설정이 수정되었습니다. 비즈니스 로직에는 영향이 없으며, 주로 문서화 및 접근 경로 관련 변경입니다.

Changes

파일/경로 그룹 변경 요약
.../bookmark/controller/BookmarkController.java 북마크 생성 엔드포인트의 POST 경로가 /{storeId}에서 /create/{storeId}로 변경됨.
.../global/config/SecurityConfig.java 인증 없이 접근 가능한 URL 패턴이 /stores/**, /menus/**, /api/users/*에서 /admin/*로 축소됨.
.../menu/controller/MenuController.java 클래스 및 주요 메서드에 OpenAPI(Swagger) 어노테이션(@Tag, @Operation, @ApiResponse) 추가.
.../menuImage/controller/MenuImageController.java 클래스 및 주요 메서드에 OpenAPI(Swagger) 어노테이션 추가.
.../store/controller/StoreController.java 클래스 및 모든 CRUD 메서드에 OpenAPI(Swagger) 어노테이션 추가.
.../storeImage/controller/StoreImageController.java 클래스 및 주요 메서드에 OpenAPI(Swagger) 어노테이션 추가.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant API_Gateway
    participant Controller

    Client->>API_Gateway: POST /api/bookmarks/create/{storeId}
    API_Gateway->>Controller: createBookmark(storeId, user)
    Controller-->>API_Gateway: Response
    API_Gateway-->>Client: Response
Loading

Possibly related PRs

Poem

API 문서에 꽃이 피고,
경로도 살짝 바뀌었네.
Swagger 태그로 반짝반짝,
보안 문도 더 단단하게!
개발자 마음도 한 뼘 성장,
오늘도 코드에 봄이 오네.
🌸✨


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between dc7e3a2 and 4f6866d.

📒 Files selected for processing (2)
  • src/main/java/com/example/gtable/menuImage/controller/MenuImageController.java (3 hunks)
  • src/main/java/com/example/gtable/storeImage/controller/StoreImageController.java (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/main/java/com/example/gtable/storeImage/controller/StoreImageController.java
  • src/main/java/com/example/gtable/menuImage/controller/MenuImageController.java
✨ 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.

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

🔭 Outside diff range comments (1)
src/main/java/com/example/gtable/global/config/SecurityConfig.java (1)

55-63: ⚠️ /admin/** 엔드포인트를 모두 permitAll()로 노출하면 관리자 기능이 무방비 상태가 됩니다

/admin/stores/**, /admin/menus/**, /admin/users/** 를 인증 없이 허용하면서
기존에 일반 사용자가 접근해야 했던 /api/users/signup, /api/users/login 등은 허용 목록에서 빠졌습니다.

결과적으로

  1. 관리자 전용 기능이 아무 제약 없이 공개되고,
  2. 회원가입·로그인 API 는 오히려 인증이 필요한 상태로 잠겨 서비스 진입 자체가 불가능해질 수 있습니다.

의도된 정책이 아니라면 다음과 같이 조정해 주세요.

-                "/admin/stores/**",
-                "/admin/menus/**",
-                "/admin/users/**",
+                "/api/users/signup",
+                "/api/users/login",
+                "/oauth2/authorization/kakao",
+                "/login/oauth2/code/**",

그리고 관리자 영역은 hasRole("ADMIN") 또는 별도 SecurityMatcher 로 보호하는 편이 안전합니다.

필요하다면 authorizeHttpRequests 재구성을 위한 예시 코드를 드릴 수 있습니다. 말씀만 주세요!

🧹 Nitpick comments (5)
src/main/java/com/example/gtable/menu/controller/MenuController.java (1)

17-20: Swagger 어노테이션 추가 👍

명세가 한눈에 들어와서 유지보수성이 좋아졌습니다.
추가적인 응답 예시(@ApiResponse@ApiResponses with content) 도 향후 고려해 보시면 좋겠습니다.

src/main/java/com/example/gtable/storeImage/controller/StoreImageController.java (1)

19-24: "주점 이미록 API" 오타 수정 필요

이미록 ➡️ 이미지 가 맞는 듯합니다 😊

-@Tag(name = "StoreImage API", description = "주점 이미록 API")
+@Tag(name = "StoreImage API", description = "주점 이미지 API")
src/main/java/com/example/gtable/menuImage/controller/MenuImageController.java (3)

17-19: Swagger 어노테이션 임포트 그룹화/정렬 제안
io.swagger.v3.oas.annotations.* 임포트를 서로 인접하게 배치하고, Spring 프레임워크 임포트와 빈 줄로 구분해주면 가독성이 향상됩니다.


21-21: @tag 애노테이션의 네이밍 일관성 검토
name = "Menu Image API"description = "메뉴 이미지 API" 중 언어(영문/한글) 사용이 혼재되어 있습니다. 프로젝트 전반의 태그 명칭 컨벤션(영문 vs. 한글)을 따라 통일하는 것을 권장드립니다.


30-32: 업로드 API 설명 수정 제안
description = "특정 주점에 대한 메뉴 이미지 업로드"는 메뉴 단위가 아닌 주점(점포) 단위로 표현되어 있습니다. 아래와 같이 명확히 변경하면 좋겠습니다:

@Operation(summary = "메뉴 이미지 업로드", description = "특정 메뉴에 대한 이미지 업로드")
@ApiResponse(responseCode = "201", description = "메뉴 이미지가 성공적으로 업로드됨")
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 81631ce and dc7e3a2.

📒 Files selected for processing (6)
  • src/main/java/com/example/gtable/bookmark/controller/BookmarkController.java (1 hunks)
  • src/main/java/com/example/gtable/global/config/SecurityConfig.java (1 hunks)
  • src/main/java/com/example/gtable/menu/controller/MenuController.java (3 hunks)
  • src/main/java/com/example/gtable/menuImage/controller/MenuImageController.java (3 hunks)
  • src/main/java/com/example/gtable/store/controller/StoreController.java (7 hunks)
  • src/main/java/com/example/gtable/storeImage/controller/StoreImageController.java (3 hunks)
🔇 Additional comments (2)
src/main/java/com/example/gtable/bookmark/controller/BookmarkController.java (1)

29-33: 경로 변경 /create/{storeId} → 기존 클라이언트 호환성 확인 필요

엔드포인트가 /{storeId} 에서 /create/{storeId} 로 바뀌었습니다.
배포 전에 모바일·프론트엔드 쪽에서 호출 URL 을 모두 수정했는지 꼭 확인해 주세요.
API 버전 관리(예: /v1/…)가 없다면 구형 클라이언트는 404 를 받게 됩니다.

src/main/java/com/example/gtable/store/controller/StoreController.java (1)

21-27: 문서화 품질 향상 👍

@Tag 및 각 메서드의 @Operation 추가는 REST 명세 일관성 확보에 큰 도움이 됩니다.
추가로 @Parameter(hidden = true) 로 불필요한 파라미터 노출을 숨길 수도 있으니 참고해주세요.

- 삭제 시 responsecode 수정
@HyemIin HyemIin merged commit eefdc5b into develop Jun 17, 2025
1 check 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