Skip to content

[REFACTOR] 카테고리, 포폴, 상품, 예약, 리뷰, 위시 도메인 Annotation 재정비 #251

Merged
earl9rey merged 6 commits intodevelopfrom
refactor/#245/category-annotation
Feb 23, 2026
Merged

[REFACTOR] 카테고리, 포폴, 상품, 예약, 리뷰, 위시 도메인 Annotation 재정비 #251
earl9rey merged 6 commits intodevelopfrom
refactor/#245/category-annotation

Conversation

@earl9rey
Copy link
Contributor

@earl9rey earl9rey commented Feb 22, 2026

👀 Summary

🖇️ Tasks

  • category 도메인 annotation 재정비
  • portfolio 도메인 annotation 재정비
  • product 도메인 annotation 재정비
  • reservation 도메인 annotation 재정비
  • review 도메인 annotation 재정비
  • wish 도메인 annotation 재정비

🔍 To Reviewer

#241 에서 정리한 코드 컨벤션을 바탕으로 어노테이션을 정리했으며, 기능 상의 변경사항은 없습니다.

@coderabbitai
Copy link

coderabbitai bot commented Feb 22, 2026

📝 Walkthrough

Walkthrough

API 인터페이스로 HTTP 매핑 및 일부 파라미터/검증 어노테이션을 이동하고, 컨트롤러 구현에서는 해당 매핑/바인딩 어노테이션들을 제거하거나 컨트롤러 레벨 검증(@Validated)을 추가하는 리팩터링입니다. 대상 도메인: 카테고리, 포트폴리오, 리뷰, 상품, 위시.

Changes

Cohort / File(s) Summary
카테고리
src/main/java/org/sopt/snappinserver/api/v1/category/controller/CategoryApi.java, src/main/java/org/sopt/snappinserver/api/v1/category/controller/CategoryController.java
@GetMappingCategoryApi로 추가하고 CategoryController에서 해당 매핑 제거. (GetMapping import 추가/제거)
포트폴리오
src/main/java/org/sopt/snappinserver/api/v1/portfolio/controller/PortfolioApi.java, src/main/java/org/sopt/snappinserver/api/v1/portfolio/controller/PortfolioController.java
여러 @GetMappingPortfolioApi로 이동. 컨트롤러에서 @PathVariable, @ModelAttribute 등 파라미터 바인딩 어노테이션 제거.
리뷰
src/main/java/org/sopt/snappinserver/api/v1/review/controller/ReviewApi.java, src/main/java/org/sopt/snappinserver/api/v1/review/controller/ReviewController.java
postPresignedUrl에 대한 @PostMapping("/image")ReviewApi로 이동. 컨트롤러에서 @Valid, @RequestBody 등 바인딩/검증 어노테이션 제거. 파라미터 어노테이션 일부를 @Parameter로 변경.
상품
src/main/java/org/sopt/snappinserver/api/v1/product/controller/ProductController.java
getProductList@ModelAttribute 제거로 기본 바인딩으로 변경(관련 import 제거).
위시(검증)
src/main/java/org/sopt/snappinserver/api/v1/wish/controller/WishApi.java, src/main/java/org/sopt/snappinserver/api/v1/wish/controller/WishController.java
@ValidatedWishApi에서 제거하고 WishController 클래스 레벨에 추가하여 컨트롤러 레벨 검증으로 이동.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • kaswhy

Poem

어노테이션이 자리 찾아가고,
인터페이스는 길을 밝히네.
컨트롤러는 깔끔히 정리되어,
검증은 제자리에 서고,
작은 리팩터링에 미소 한 줌 🌿✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed PR 제목이 변경사항의 핵심(카테고리, 포폴, 상품, 예약, 리뷰, 위시 도메인의 Annotation 재정비)을 명확하게 설명하고 있습니다.
Description check ✅ Passed PR 설명이 이슈 #245 참조, 작업 완료 체크리스트, PR #241의 컨벤션 기반 작업임을 명확히 기술하고 있습니다.
Linked Issues check ✅ Passed PR의 모든 변경사항(Category, Portfolio, Product, Review, Wish 도메인의 Annotation 재정비)이 이슈 #245의 요구사항을 충족합니다.
Out of Scope Changes check ✅ Passed 모든 변경사항이 Annotation 재정비라는 정의된 범위 내에 있으며, 기능 변경은 없는 리팩토링입니다.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/#245/category-annotation

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

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/main/java/org/sopt/snappinserver/api/v1/review/controller/ReviewApi.java (1)

40-41: ⚠️ Potential issue | 🟡 Minor

@PathVariable 파라미터에 @Schema 대신 @Parameter 사용을 권장합니다.

팀 컨벤션에 따르면 PathVariable, RequestParam, RequestHeader오퍼레이션 파라미터에는 @Parameter를, RequestBody DTO 필드에는 @Schema를 사용해야 합니다. 현재 reviewId는 PathVariable이므로 @Schema 대신 @Parameter가 적합합니다. @Parameter는 이미 4번 라인에 import되어 있어 별도 추가 없이 바로 사용 가능합니다.

💡 수정 제안
-   `@Schema`(description = "리뷰 ID")
-   `@PathVariable` `@NotNull` Long reviewId
+   `@Parameter`(description = "리뷰 ID")
+   `@PathVariable` `@NotNull` Long reviewId

Based on learnings: "annotate controller method parameters (e.g., RequestParam, PathVariable, RequestHeader) with Parameter, and annotate the fields of RequestBody DTOs with Schema."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/main/java/org/sopt/snappinserver/api/v1/review/controller/ReviewApi.java`
around lines 40 - 41, The method parameter reviewId in ReviewApi is a
PathVariable annotated with `@Schema` but per team convention operation parameters
should use `@Parameter`; replace the `@Schema` annotation on the `@PathVariable` Long
reviewId with `@Parameter` (no import needed since `@Parameter` is already imported)
so the PathVariable parameter follows the convention for operation parameters.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In
`@src/main/java/org/sopt/snappinserver/api/v1/review/controller/ReviewApi.java`:
- Around line 40-41: The method parameter reviewId in ReviewApi is a
PathVariable annotated with `@Schema` but per team convention operation parameters
should use `@Parameter`; replace the `@Schema` annotation on the `@PathVariable` Long
reviewId with `@Parameter` (no import needed since `@Parameter` is already imported)
so the PathVariable parameter follows the convention for operation parameters.

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: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@src/main/java/org/sopt/snappinserver/api/v1/review/controller/ReviewApi.java`:
- Around line 39-40: The PathVariable parameter reviewId in ReviewApi should
validate that it is a positive DB identifier and provide an example for Swagger:
add the javax.validation.constraints.@Positive annotation alongside `@NotNull` on
the reviewId parameter and augment the `@Parameter`(...) declaration to include an
example (e.g., example = "1") so the controller method signature (the reviewId
parameter in ReviewApi) both enforces >0 at the API layer and improves OpenAPI
docs.

Comment on lines +39 to 40
@Parameter(description = "리뷰 ID")
@PathVariable @NotNull Long reviewId
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

@PathVariable 파라미터에 @Positive 추가를 고려해보세요.

@Schema@Parameter 변경은 PathVariable 파라미터 문서화 컨벤션(PR #250 학습 내용)에 잘 맞습니다.

다만, reviewId는 DB 식별자이므로 @NotNull과 함께 @Positive를 추가하면 음수나 0이 입력되는 경우를 API 계층에서 차단할 수 있습니다. 프로젝트 내 다른 PathVariable 패턴(PR #80)에서도 @NotNull, @Positive를 함께 사용하는 것이 확인됩니다.

추가로, @Parameter(description = "리뷰 ID")example 속성을 함께 작성하면 Swagger 문서 품질이 향상됩니다.

✨ 제안 수정 사항
-    `@Parameter`(description = "리뷰 ID")
-    `@PathVariable` `@NotNull` Long reviewId
+    `@Parameter`(description = "리뷰 ID", example = "1", required = true)
+    `@PathVariable` `@NotNull` `@Positive` Long reviewId

Based on learnings: "define API-facing interfaces for controllers that declare PathVariable, NotNull, Positive, etc." (PR #80) and "leverage description, required, and example attributes where appropriate" (PR #250).

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/main/java/org/sopt/snappinserver/api/v1/review/controller/ReviewApi.java`
around lines 39 - 40, The PathVariable parameter reviewId in ReviewApi should
validate that it is a positive DB identifier and provide an example for Swagger:
add the javax.validation.constraints.@Positive annotation alongside `@NotNull` on
the reviewId parameter and augment the `@Parameter`(...) declaration to include an
example (e.g., example = "1") so the controller method signature (the reviewId
parameter in ReviewApi) both enforces >0 at the API layer and improves OpenAPI
docs.

Copy link
Member

@kaswhy kaswhy left a comment

Choose a reason for hiding this comment

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

굿굿 고생하셨습니다!

@earl9rey earl9rey merged commit d141846 into develop Feb 23, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

⚒️ [REFACTOR] 카테고리, 포폴, 상품, 예약, 리뷰, 위시 관련 도메인 Annotation 재정비

2 participants