Skip to content

[BE] SISC1-230 [FEAT] 출석세션-고아객체-삭제-로직-추가#159

Merged
Kosw6 merged 3 commits intomainfrom
SISC1-230-BE-출석세션-고아객체-삭제-로직-추가
Dec 2, 2025

Hidden character warning

The head ref may contain hidden characters: "SISC1-230-BE-\ucd9c\uc11d\uc138\uc158-\uace0\uc544\uac1d\uccb4-\uc0ad\uc81c-\ub85c\uc9c1-\ucd94\uac00"
Merged

[BE] SISC1-230 [FEAT] 출석세션-고아객체-삭제-로직-추가#159
Kosw6 merged 3 commits intomainfrom
SISC1-230-BE-출석세션-고아객체-삭제-로직-추가

Conversation

@ochanhyeok
Copy link
Contributor

@ochanhyeok ochanhyeok commented Dec 2, 2025

Summary by CodeRabbit

릴리즈 노트

  • 새 기능

    • 출석 세션에서 연관된 사용자 목록을 명시적으로 관리하는 기능을 추가했습니다.
  • 버그 수정

    • 세션 관련 데이터 삭제 시 고아 레코드와 불일치 발생을 방지하도록 삭제 동작을 강화했습니다.
  • 개선 사항

    • 출석 데이터의 직렬화 및 수정 흐름을 개선해 데이터 무결성과 업데이트 안정성을 높였습니다.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 2, 2025

Walkthrough

AttendanceSessionsessionUsers 컬렉션을 추가하고 rounds/attendances 관계에 orphanRemoval = true를 설정했습니다. SessionUser@JsonBackReference와 필드 단위 @Setter가 추가되었고, Attendance는 클래스 레벨 @Setter를 제거하고 일부 필드에만 @Setter를 부여했습니다.

Changes

Cohort / File(s) 변경 요약
AttendanceSession 엔티티 변경
backend/src/main/java/org/sejongisc/backend/attendance/entity/AttendanceSession.java
private List<SessionUser> sessionUsers 필드 추가 (JPA·Jackson 어노테이션 포함, 초기화); 기존 roundsattendances 매핑에 orphanRemoval = true 추가; 어노테이션 순서 조정
SessionUser 엔티티 변경
backend/src/main/java/org/sejongisc/backend/attendance/entity/SessionUser.java
attendanceSession 필드에 @JsonBackReference 추가; userName 등 필드에 @lombok.Setter 추가(필드 단위 setter); Lombok 임포트가 와일드카드로 변경
Attendance 엔티티 변경
backend/src/main/java/org/sejongisc/backend/attendance/entity/Attendance.java
클래스 레벨 @Setter 제거; attendanceStatus, checkedAt, awardedPoints, note, checkInLocation, deviceInfo, anonymousUserName 등 특정 필드에만 @lombok.Setter 추가 (setter 가시성/범위 제한)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • 추가 검토 포인트:
    • AttendanceSession.roundsattendances에 설정된 orphanRemoval = true가 의도한 삭제/영속성 동작을 유발하는지(삭제 전파, cascade 조합) 검증
    • sessionUsers 양방향 매핑과 @JsonBackReference가 직렬화/역직렬화 및 DTO/서비스 계층에 미치는 영향
    • Attendance의 클래스 레벨 @Setter 제거로 인한 코드 호출지점(테스트/서비스/매퍼) 영향 확인

Possibly related PRs

Suggested reviewers

  • discipline24

Poem

🐰 풀밭에 깡충, 새 필드 하나 심었네
라운드와 출석이 손잡고 달리니
고아 제거는 조심히, 발자국은 가볍게
직렬화는 뒤에서 살짝 도와주고
깡충, 깡충, 코드도 한껏 폴짝폴짝 🎋

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 제목이 변경사항의 주요 내용과 일치합니다. 출석세션 엔티티에 고아객체 삭제 로직(orphanRemoval = true)을 추가하는 것이 이번 PR의 핵심이며, 제목에서 이를 명확하게 표현하고 있습니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch SISC1-230-BE-출석세션-고아객체-삭제-로직-추가

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.

Actionable comments posted: 1

🧹 Nitpick comments (2)
backend/src/main/java/org/sejongisc/backend/attendance/entity/SessionUser.java (2)

4-4: 와일드카드 import 사용 지양

명시적 import 대신 lombok.* 와일드카드를 사용하면 실제로 어떤 어노테이션이 사용되는지 파악하기 어렵습니다.

-import lombok.*;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;

30-31: 클래스 레벨 @Setter 사용 시 주의 필요

클래스 레벨에 @Setter를 적용하면 sessionUserId (Primary Key)를 포함한 모든 필드에 setter가 생성됩니다. PK 변경은 데이터 무결성 문제를 야기할 수 있습니다.

양방향 관계 관리를 위해 attendanceSession 필드에만 setter가 필요하다면, 필드 레벨 @Setter 사용을 권장합니다.

 @Getter
-@Setter
 @Builder
 @NoArgsConstructor
 @AllArgsConstructor
 public class SessionUser extends BasePostgresEntity {

그리고 필요한 필드에만 개별적으로 적용:

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "session_id", nullable = false)
    @Setter
    private AttendanceSession attendanceSession;
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b04f104 and 3554613.

📒 Files selected for processing (2)
  • backend/src/main/java/org/sejongisc/backend/attendance/entity/AttendanceSession.java (1 hunks)
  • backend/src/main/java/org/sejongisc/backend/attendance/entity/SessionUser.java (2 hunks)
🔇 Additional comments (1)
backend/src/main/java/org/sejongisc/backend/attendance/entity/AttendanceSession.java (1)

48-61: orphanRemoval 적용 승인

rounds, sessionUsers, attendances 컬렉션에 orphanRemoval = true를 추가하여 컬렉션에서 제거된 엔티티가 자동으로 삭제되도록 설정한 점이 PR 목표(고아 객체 삭제 로직 추가)에 부합합니다.

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

🧹 Nitpick comments (1)
backend/src/main/java/org/sejongisc/backend/attendance/entity/SessionUser.java (1)

5-5: 명시적 임포트 사용을 권장합니다.

와일드카드 임포트(import lombok.*)는 Java 코딩 컨벤션에서 권장되지 않습니다. 클래스의 출처가 불명확해지고 네이밍 충돌 가능성이 있습니다.

다음과 같이 명시적 임포트로 변경하는 것을 고려해주세요:

-import lombok.*;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3554613 and 9cfadcd.

📒 Files selected for processing (2)
  • backend/src/main/java/org/sejongisc/backend/attendance/entity/AttendanceSession.java (1 hunks)
  • backend/src/main/java/org/sejongisc/backend/attendance/entity/SessionUser.java (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • backend/src/main/java/org/sejongisc/backend/attendance/entity/AttendanceSession.java

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

🧹 Nitpick comments (1)
backend/src/main/java/org/sejongisc/backend/attendance/entity/SessionUser.java (1)

5-5: 와일드카드 임포트 대신 명시적 임포트를 권장합니다.

lombok.* 와일드카드 임포트는 어떤 Lombok 어노테이션이 사용되는지 명확하지 않습니다. 코드 가독성과 IDE 지원을 위해 사용하는 어노테이션만 명시적으로 임포트하는 것이 좋습니다.

-import lombok.*;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9cfadcd and e337769.

📒 Files selected for processing (2)
  • backend/src/main/java/org/sejongisc/backend/attendance/entity/Attendance.java (1 hunks)
  • backend/src/main/java/org/sejongisc/backend/attendance/entity/SessionUser.java (2 hunks)
🔇 Additional comments (3)
backend/src/main/java/org/sejongisc/backend/attendance/entity/SessionUser.java (2)

42-45: 양방향 관계에 대한 @JsonBackReference 설정이 올바릅니다.

attendanceSession 필드에 @JsonBackReference를 추가한 것은 AttendanceSession과의 양방향 관계를 올바르게 처리하며, 순환 참조를 방지합니다. 이전 리뷰 코멘트에서 지적된 단방향 관계인 user 필드에는 @JsonBackReference가 없어 적절하게 수정되었습니다.


51-53: 필드 단위 setter 적용이 적절합니다.

클래스 레벨 @Setter를 제거하고 userName 필드에만 개별 setter를 추가한 것은 엔티티 캡슐화를 개선합니다. 이는 ID 필드(sessionUserId)와 연관관계 필드(attendanceSession, user)에 대한 무분별한 수정을 방지하며, 이전 리뷰에서 지적된 데이터 무결성 문제를 해결합니다.

backend/src/main/java/org/sejongisc/backend/attendance/entity/Attendance.java (1)

40-66: 필드 단위 setter 전략이 엔티티 캡슐화를 개선합니다.

클래스 레벨 @Setter를 제거하고 필요한 필드에만 개별 setter를 적용한 것은 좋은 접근입니다. 특히 attendanceId(기본 키)와 연관관계 필드(user, attendanceSession, attendanceRound)에 setter가 생성되지 않도록 하여 엔티티 무결성을 보호합니다.

@Kosw6 Kosw6 merged commit 782d3b1 into main Dec 2, 2025
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.

2 participants