Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
이 PR은 출석/보증금 도메인의 PK 타입을 엔티티와 정합시키고, Q&A 질문 상세 조회의 N+1을 줄이며, 좋아요 카운트 동시성(lost update) 문제를 완화하는 변경을 포함합니다.
Changes:
- Attendance/AttendanceCode/Deposit Repository의 ID 제네릭 타입을
Long -> Integer로 정합화하고 불필요한 변환 로직을 제거 - 질문 상세 조회에서 작성자/댓글 작성자/부모댓글/익명번호를 배치 로딩하여 N+1을 줄이고 DTO 조립 로직을 재구성
- 좋아요 토글 시 질문 row에
PESSIMISTIC_WRITE락을 적용하는 전용 조회 메서드를 추가
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| backend/src/main/resources/db/migration/V8__drop_question_anonymous_no_unique_constraint.sql | 질문 익명번호 제약(legacy) 제거 마이그레이션 추가 |
| backend/src/main/java/com/example/Piroin/project/domain/user/service/AdminUserService.java | 출석 ID 처리 타입을 Integer 기준으로 정리 |
| backend/src/main/java/com/example/Piroin/project/domain/question/service/QuestionService.java | 상세 조회 댓글/대댓글 조립 로직 개선 및 좋아요 토글용 조회 분리 |
| backend/src/main/java/com/example/Piroin/project/domain/question/repository/QuestionRepository.java | 상세 조회(fetch join) / 좋아요 갱신용(for update) 조회 메서드 추가 |
| backend/src/main/java/com/example/Piroin/project/domain/question/repository/QuestionCommentRepository.java | 상세 조회용 댓글 목록을 fetch join으로 일괄 로딩하도록 변경 |
| backend/src/main/java/com/example/Piroin/project/domain/question/repository/QuestionAnonymousIdentityRepository.java | 상세 조회에서 익명번호를 일괄 조회하는 메서드 추가 |
| backend/src/main/java/com/example/Piroin/project/domain/question/entity/QuestionAnonymousIdentity.java | 익명번호 유니크 제약 정리(제약 제거/이름 정합) |
| backend/src/main/java/com/example/Piroin/project/domain/deposit/repository/DepositRepository.java | Deposit PK 타입 정합화(Integer) |
| backend/src/main/java/com/example/Piroin/project/domain/attendance/service/AttendanceService.java | 출석 체크 로직에서 불필요한 Long.valueOf() 변환 제거 |
| backend/src/main/java/com/example/Piroin/project/domain/attendance/repository/AttendanceRepository.java | Attendance PK 타입 정합화(Integer) |
| backend/src/main/java/com/example/Piroin/project/domain/attendance/repository/AttendanceCodeRepository.java | AttendanceCode PK 타입 정합화(Integer) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
10
to
16
| @Table( | ||
| name = "question_anonymous_identity", | ||
| uniqueConstraints = { | ||
| @UniqueConstraint( | ||
| name = "uq_question_anon_question_user", | ||
| name = "uq_question_anonymous_identity_question_user", | ||
| columnNames = {"question_id", "user_id"} | ||
| ), | ||
| @UniqueConstraint( | ||
| name = "uq_question_anon_question_no", | ||
| columnNames = {"question_id", "anonymous_no"} | ||
| ) |
Comment on lines
+1
to
+4
| -- Anonymous numbers are scoped by role, so member #1 and admin #1 can coexist in the same question. | ||
| -- Drop the legacy question_id + anonymous_no constraint if it exists. | ||
| ALTER TABLE question_anonymous_identity | ||
| DROP CONSTRAINT IF EXISTS uq_question_anon_question_no; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#️⃣연관된 이슈
#207
📝작업 내용
출석 및 보증금 ID 타입 정합성 수정
AttendanceCodeRepository의 ID 타입을Long에서Integer로 수정AttendanceRepository의 ID 타입을Long에서Integer로 수정DepositRepository의 ID 타입을Long에서Integer로 수정Long.valueOf()변환 제거Integer기준으로 처리하도록 수정질문 익명 번호 유니크 제약 정합성 수정
question_anonymous_identity의 유니크 제약 이름 정리기존
question_id + anonymous_no유니크 제약 제거역할별 익명 번호 정책에 맞게
익명1과운영진1이 같은 질문 내에서 공존할 수 있도록 수정Flyway 마이그레이션 파일 추가
V8__drop_question_anonymous_no_unique_constraint.sql질문 상세 조회 N+1 개선
JOIN FETCH로 함께 조회DetailCommentContext추가댓글/대댓글 구조 조립 로직 개선
좋아요 카운트 동시성 보강
PESSIMISTIC_WRITE락 적용likeCountlost update가 발생하지 않도록 처리findByIdAndDeletedAtIsNullForUpdate추가