Skip to content

fix: DB 제약 위반 예외 처리 및 신청 DTO 필드 검증 추가#251

Merged
dongmin0204 merged 1 commit into
developfrom
fix/h5-h8-validation-exception
Jul 6, 2026
Merged

fix: DB 제약 위반 예외 처리 및 신청 DTO 필드 검증 추가#251
dongmin0204 merged 1 commit into
developfrom
fix/h5-h8-validation-exception

Conversation

@yoon6yo

@yoon6yo yoon6yo commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

관련 이슈

변경 사항

[H-5] GlobalExceptionHandler.java — DataIntegrityViolationException 핸들러 추가

동시 요청으로 인한 DB unique 제약 위반 시 HTTP 500 대신 409 CONFLICT를 반환합니다.

@ExceptionHandler(DataIntegrityViolationException.class)
protected ResponseEntity<ErrorResponse> handleDataIntegrityViolationException(...) {
    return ResponseEntity.status(HttpStatus.CONFLICT).body(ErrorResponse.of(ErrorCode.CONFLICT));
}

[H-8] SaveRequestRequestDTO.java — validation 어노테이션 추가

필드 추가된 어노테이션 이유
volumeSizeGiB @NotNull, @Positive null/0/음수 시 PVC API 오류 방지
usagePurpose @NotBlank null 시 DB constraint violation 방지
expiresAt @NotNull, @Future null 또는 과거 날짜 차단

테스트

  • 기존 테스트 전체 통과 확인 (./gradlew test)

🤖 Generated with Claude Code

- [H-5] GlobalExceptionHandler에 DataIntegrityViolationException 핸들러 추가
  race condition으로 인한 DB unique 제약 위반 시 HTTP 500 대신 409 CONFLICT 반환
- [H-8] SaveRequestRequestDTO 핵심 필드 validation 어노테이션 추가
  - volumeSizeGiB: @NotNull, @positive
  - usagePurpose: @notblank
  - expiresAt: @NotNull, @future

Closes #245, #248

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 5, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: fad54993-2021-4464-beef-2f674372f74e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/h5-h8-validation-exception

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.

@dongmin0204 dongmin0204 merged commit 01e710e into develop Jul 6, 2026
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.

[H-8] SaveRequestRequestDTO 핵심 필드 validation 누락 [H-5] username 중복 체크 race condition → DB 제약 위반 시 HTTP 500

2 participants