Skip to content

refactor: [CHE] 옵션Id 저장 추가#106

Merged
hyeeuncho merged 1 commit into
developfrom
dev/hyen
Apr 30, 2026
Merged

refactor: [CHE] 옵션Id 저장 추가#106
hyeeuncho merged 1 commit into
developfrom
dev/hyen

Conversation

@hyeeuncho
Copy link
Copy Markdown
Contributor

💡 PR 제목

예: feat: [KHG] 로그인 API 구현


🔗 관련 이슈

진행 중이면 Refs #123, 완전 해결이면 Closes #123 (완전히 끝났을 때만)

  • Refs/Closes: #

📌 작업 내용 요약

  • 주요 변경 1
  • 주요 변경 2
  • 주요 변경 3

🧱 변경 범위 (Scope)

Backend

  • API 추가/수정
  • Validation/예외처리
  • 인증/인가
  • DB 스키마/쿼리
  • 기타:

Frontend

  • UI/라우팅
  • 상태관리/비동기 로직
  • 입력값/검증
  • 기타:

🧪 테스트 내역

Backend

  • 로컬에서 애플리케이션 실행 확인
  • 단위 테스트 통과
  • API 수동 테스트 (Postman / Swagger 등)

Frontend

  • npm run dev 로컬 실행 확인
  • 주요 화면/기능 수동 테스트

테스트 상세(필수)

테스트한 API/페이지/케이스를 간단히 적어주세요.

  • 예) 로그인 성공/실패, 회원가입, 목록 조회 등

🖼️ 화면 캡처 / 시연 영상 (Frontend 변경 시 권장)

  • before:
  • after:

⚠️ 영향도 / 리스크 / 롤백

리뷰어가 “머지해도 되는지” 판단하기 위한 섹션입니다.

  • 영향도: (예: 기존 API 응답 변경 없음 / 있음)
  • 리스크: (예: 권한 로직 수정, 쿼리 성능, 마이그레이션 필요 등)
  • 롤백 방법: (예: revert 커밋 / 기능 플래그 off / 마이그레이션 롤백 불가 등)

✅ 리뷰어 체크 포인트 (선택)

리뷰어가 집중해서 봐줬으면 하는 부분이 있으면 적어주세요.

  • 예) 트랜잭션 범위, 권한 체크, N+1, 상태관리 로직 등

@hyeeuncho hyeeuncho self-assigned this Apr 30, 2026
Copy link
Copy Markdown
Contributor

@rlaalsdn0421 rlaalsdn0421 left a comment

Choose a reason for hiding this comment

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

lgtm

@hyeeuncho hyeeuncho merged commit 5dd9e76 into develop Apr 30, 2026
1 check passed
@hyeeuncho hyeeuncho deleted the dev/hyen branch April 30, 2026 06:53
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds an explicit call to saveAndFlush within the updateOption method of OptionService. Feedback suggests removing this call because the method is already annotated with @transactional, allowing JPA's dirty checking to handle the persistence automatically, thus keeping the code cleaner.

Comment on lines +85 to 86
optionRepository.saveAndFlush(option);
return ResponseOptionDto.from(option);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

updateOption 메서드는 @Transactional 어노테이션이 적용되어 있어, JPA의 변경 감지(Dirty Checking) 기능에 의해 메서드 종료 시 변경 사항이 자동으로 데이터베이스에 반영됩니다. PR 제목에 언급된 '옵션Id 저장'과 관련하여, option 객체는 이미 ID를 가지고 있으며 영속성 컨텍스트에서 관리되고 있으므로 saveAndFlush를 명시적으로 호출하지 않아도 데이터베이스에 정상적으로 저장됩니다. 만약 Audit 필드(updatedAt 등)를 즉시 반영하여 응답 DTO에 포함해야 하는 특수한 상황이 아니라면, 이 라인을 제거하여 코드를 간결하게 유지하는 것을 권장합니다.

Suggested change
optionRepository.saveAndFlush(option);
return ResponseOptionDto.from(option);
return ResponseOptionDto.from(option);

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