Skip to content

Conversation

@pwc2002
Copy link
Contributor

@pwc2002 pwc2002 commented Aug 30, 2025

📌 연관된 이슈

#209

✨ 작업 내용

중복 email 검증 코드에서 get 요청이지만 body 을 요청하는 코드를 get 요청에 param 을 요청하는코드로 변경하였습니다.

💬 리뷰 요구사항(선택)

Summary by CodeRabbit

  • 리팩터링
    • 이메일 중복 확인 API의 요청 형식을 JSON 본문에서 쿼리 파라미터(email)로 변경했습니다. 이제 GET 요청 시 ?email=[email protected] 형태로 전달하세요.
    • 응답 구조와 상태 코드는 변함없고 엔드포인트 경로도 동일합니다. 기능은 그대로 유지됩니다.
    • 기존 클라이언트는 요청 형식을 업데이트해야 합니다. 폼/브라우저에서의 직접 호출이 더 간단해집니다.

@pwc2002 pwc2002 self-assigned this Aug 30, 2025
@pwc2002 pwc2002 added the bug Something isn't working label Aug 30, 2025
@coderabbitai
Copy link

coderabbitai bot commented Aug 30, 2025

Walkthrough

UserController.checkDuplicatedEmail가 JSON 본문 입력에서 쿼리 파라미터(email) 입력으로 변경되었습니다. 컨트롤러는 수신한 emailCheckDuplicatedEmailRequest를 생성해 서비스에 전달합니다. 엔드포인트 경로와 응답 형식은 동일합니다.

Changes

Cohort / File(s) Summary
컨트롤러 엔드포인트 시그니처 변경
src/main/java/inha/gdgoc/domain/user/controller/UserController.java
@RequestBody CheckDuplicatedEmailRequest@RequestParam String email로 시그니처 수정; 내부에서 new CheckDuplicatedEmailRequest(email) 생성 후 userService.isExistsByEmail(...) 호출로 변경. 응답 구조/경로 유지.

Sequence Diagram(s)

sequenceDiagram
    participant C as Client
    participant UC as UserController
    participant US as UserService

    C->>UC: GET /api/v1/auth/check?email={email}
    UC->>UC: CheckDuplicatedEmailRequest req = new(email)
    UC->>US: isExistsByEmail(req)
    US-->>UC: boolean exists
    alt 중복 이메일
        UC-->>C: 200 ApiResponse<CheckDuplicatedEmailResponse>(exists=true)
    else 미중복
        UC-->>C: 200 ApiResponse<CheckDuplicatedEmailResponse>(exists=false)
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

Poem

깡충깡충, 쿼리로 점프해 보니,
바디 대신 email 한 줄이면 되지요.
컨트롤러 살짝 몸을 비틀고,
서비스로 살포시 메일을 전해요.
오늘도 버그는 굿바이,
당근 들고 축하해요! 🥕🐇

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/issue-209

🪧 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.
    • 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.
  • 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 the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

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

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit 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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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
Copy link

CI status
✅ Assemble 성공
✅ Test 성공

@pwc2002 pwc2002 merged commit 9676b73 into develop Aug 30, 2025
1 of 2 checks passed
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

Caution

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

⚠️ Outside diff range comments (2)
src/main/java/inha/gdgoc/domain/user/controller/UserController.java (2)

17-22: 컴파일 실패: @RequestParam import 누락

@RequestParam을 사용하지만 import가 없습니다. 즉시 빌드 에러 납니다.

아래 import를 추가해 주세요.

 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
+import jakarta.validation.constraints.Email;
+import jakarta.validation.constraints.NotBlank;
+import org.springframework.validation.annotation.Validated;

24-27: 메서드 파라미터 검증 활성화를 위해 @validated 추가 권장

@RequestParam 수준의 제약이 적용되도록 클래스에 @Validated를 추가하는 것을 권장합니다. (전역 설정으로 대체 중이라면 생략 가능)

 @RequestMapping("/api/v1")
 @RequiredArgsConstructor
 @RestController
+@Validated
 public class UserController {
🧹 Nitpick comments (2)
src/main/java/inha/gdgoc/domain/user/controller/UserController.java (2)

31-31: 부적절한 TODO 주석 정리

비속어가 포함된 주석은 저장소에 남기지 않는 것이 좋습니다. 필요 시 이슈로 전환하거나 중립적으로 표현해 주세요.

-    // TODO 진짜 돌았냐? POST로 바꿔라
+    // TODO: 필요 시 정책/보안 검토 후 POST 전환 고려

32-40: 엔드포인트 명명/보안 관점 제안

  • 경로 통일성: 다른 컨트롤러의 /check/student-id, /check/phone-number와 맞추려면 /auth/check/email 같은 명시적 경로가 가독성에 유리합니다.
  • 계정 열거 방지: 이메일 중복 조회는 열거 공격 표면입니다. 레이트 리밋(예: IP/Key 기반), 캡차, 감사 로그(시도/응답), 응답 표준화(필요 시) 등을 검토해 주세요.
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 0abadec and d3e192a.

📒 Files selected for processing (1)
  • src/main/java/inha/gdgoc/domain/user/controller/UserController.java (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/main/java/inha/gdgoc/domain/user/controller/UserController.java (2)
src/main/java/inha/gdgoc/domain/user/service/UserService.java (1)
  • isExistsByEmail (31-33)
src/main/java/inha/gdgoc/domain/recruit/controller/RecruitMemberController.java (2)
  • GetMapping (62-72)
  • GetMapping (74-85)
🔇 Additional comments (1)
src/main/java/inha/gdgoc/domain/user/controller/UserController.java (1)

36-37: 서비스 호출로 DTO 재구성하는 방식은 적절합니다

쿼리 파라미터로 받은 값을 DTO로 감싸 서비스에 위임하는 흐름은 일관되고 테스트 용이합니다.

Comment on lines +34 to 35
@RequestParam String email
) {
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

쿼리 파라미터로 바뀌면서 입력 검증이 빠졌습니다 — 필수/형식 검증 추가 권장

기존 @RequestBody @Valid 경로에서 넘어오던 Bean Validation이 사라졌을 가능성이 큽니다. 최소한 공백/형식 검증을 파라미터에 직접 부여해 동일한 계약을 유지하세요.

아래처럼 수정 제안드립니다.

-            @RequestParam String email
+            @RequestParam
+            @NotBlank(message = "이메일은 필수 입력 값입니다.")
+            @Email(message = "유효하지 않은 이메일 형식입니다.")
+            String email

다음 스크립트로 프로젝트가 jakarta.validation 또는 javax.validation 중 무엇을 사용 중인지, 그리고 컨트롤러 메서드 파라미터 검증이 활성화되어 있는지 확인해 주세요.


🏁 Script executed:

#!/bin/bash
# jakarta/javax 사용 현황
rg -nP 'import\s+(jakarta|javax)\.validation' -C1

# @Validated 사용 여부(메서드/파라미터 검증용)
rg -nP '@Validated' -g 'src/**/controller/**.java' -C2

# 이 엔드포인트 사용처(클라이언트/문서 영향도 확인)
rg -nP '/api/v1/auth/check\b' -C2

Length of output: 1441


UserController 클래스에 @validated 추가 및 이메일 파라미터 검증 어노테이션 적용
파라미터 검증이 활성화되어 있지 않으므로, jakarta.validation 제약(@notblank, @Email)을 사용하려면 클래스에 @Validated를 추가하고 이메일 파라미터에 다음과 같이 어노테이션을 부여하세요:

diff --git a/src/main/java/inha/gdgoc/domain/user/controller/UserController.java b/src/main/java/inha/gdgoc/domain/user/controller/UserController.java
index e69de29..abcd123 100644
--- a/src/main/java/inha/gdgoc/domain/user/controller/UserController.java
+++ b/src/main/java/inha/gdgoc/domain/user/controller/UserController.java
@@ -1,7 +1,11 @@
 package inha.gdgoc.domain.user.controller;

+import org.springframework.validation.annotation.Validated;
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.Email;
 import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;

 @RestController
 @RequestMapping("/api/v1/auth")
+@Validated
 public class UserController {
     @GetMapping("/check")
-    public ResponseEntity<?> checkEmail(@RequestParam String email) {
+    public ResponseEntity<?> checkEmail(
+        @RequestParam
+        @NotBlank(message = "이메일은 필수 입력 값입니다.")
+        @Email(message = "유효하지 않은 이메일 형식입니다.")
+        String email
+    ) {
         // …
     }
 }
📝 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
@RequestParam String email
) {
package inha.gdgoc.domain.user.controller;
import org.springframework.validation.annotation.Validated;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Email;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/api/v1/auth")
@Validated
public class UserController {
@GetMapping("/check")
public ResponseEntity<?> checkEmail(
@RequestParam
@NotBlank(message = "이메일은 필수 입력 값입니다.")
@Email(message = "유효하지 않은 이메일 형식입니다.")
String email
) {
// …
}
}
🤖 Prompt for AI Agents
In src/main/java/inha/gdgoc/domain/user/controller/UserController.java around
lines 34-35, method parameter validation is not enabled: add the Spring/JSR
validation support by annotating the controller class with @Validated and
annotate the email parameter with @NotBlank and @Email (importing
jakarta.validation.constraints.NotBlank and
jakarta.validation.constraints.Email). Ensure the controller class imports
org.springframework.validation.annotation.Validated and the parameter uses the
validation annotations so the framework enforces the constraints at runtime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants