Skip to content

Fix: User 관련 감사 필드 선언 UUID로 수정 - #25

Open
bomzae wants to merge 3 commits into
devfrom
24-fix-change-the-audit-field-to-uuid
Open

bomzae wants to merge 3 commits into
devfrom
24-fix-change-the-audit-field-to-uuid

Conversation

@bomzae

@bomzae bomzae commented Apr 5, 2026

Copy link
Copy Markdown
Contributor

🌱 설명

감사 필드의 생성자, 수정자, 삭제자를 UUID로 변경

📌 관련 이슈

✅ 주요 변경 사항

  • User 관련 감사 필드(createdBy, updatedBy, deletedBy)가 명세서와 달리 String으로 선언된 오류 수정
  • 0.1.4-SNAPSHOT 버전으로 수정하여 배포

📝 체크리스트

PR 올리기 전에 아래 항목을 확인해주세요.

  • develop 브랜치 기준으로 feature 브랜치를 생성했나요?
  • 코드 컨벤션 및 스타일 가이드를 준수했나요?
  • 관련 이슈와 연결했나요?
  • 어려운 부분 / 공유가 필요한 부분에 주석을 추가했나요?
  • 제가 작성한 코드를 스스로 리뷰했나요?
  • 기존 테스트와 충돌하지 않음을 확인했나요?

📚 추가 설명

리뷰어가 참고해야 할 내용이 있다면 자유롭게 작성해주세요. (선택)

Summary by CodeRabbit

릴리스 노트

  • Chores

    • 프로젝트 버전이 0.1.4-SNAPSHOT으로 업데이트되었습니다.
  • Bug Fixes

    • 감사(audit) 관련 식별자 유형이 String에서 UUID로 변경되었습니다.
    • 소프트 삭제/복원 흐름이 UUID를 직접 사용하도록 수정되었고, 삭제 동작의 접근성이 공개로 변경되었습니다.
    • 감사자 길이 검증 및 "SYSTEM" 대체 로직이 제거되었습니다.

@bomzae bomzae linked an issue Apr 5, 2026 that may be closed by this pull request
1 task
@coderabbitai

coderabbitai Bot commented Apr 5, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 57cef86d-6369-4309-b686-2c7934438c4b

📥 Commits

Reviewing files that changed from the base of the PR and between a39074c and de9f1eb.

📒 Files selected for processing (1)
  • src/main/java/com/fhsh/daitda/domain/BaseUserEntity.java
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/java/com/fhsh/daitda/domain/BaseUserEntity.java

📝 Walkthrough

Walkthrough

프로젝트 버전이 0.1.3-SNAPSHOT에서 0.1.4-SNAPSHOT으로 업데이트되었습니다. 도메인 엔티티 BaseUserEntity의 감사 필드 createdBy, updatedBy, deletedBy 타입이 String에서 UUID로 변경되었고, delete 메서드의 가시성이 protected에서 public으로 변경되었으며 delete(UUID)restore(UUID) 시그니처로 업데이트되었습니다. 문자열 기반의 "SYSTEM" 대체 로직과 길이 검증 유틸리티가 제거되었습니다.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • ilovemusicandprogramming
  • HOHOKIM
  • jihxonx
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목이 변경 사항의 주요 내용을 명확하게 설명하고 있으며, 감사 필드를 UUID로 수정한다는 핵심 변경 내용을 정확하게 반영합니다.
Linked Issues check ✅ Passed PR의 모든 코드 변경 사항이 이슈 #24의 요구 사항을 충족합니다: createdBy, updatedBy, deletedBy 필드를 String에서 UUID로 변경하고, 관련 메서드 서명을 업데이트했습니다.
Out of Scope Changes check ✅ Passed build.gradle의 버전 업데이트는 배포 준비를 위한 범위 내 변경이며, 모든 변경 사항이 이슈 #24의 감사 필드 UUID 변경과 관련된 범위 내 작업입니다.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 24-fix-change-the-audit-field-to-uuid

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 2

Caution

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

⚠️ Outside diff range comments (1)
src/main/java/com/fhsh/daitda/domain/BaseUserEntity.java (1)

29-40: ⚠️ Potential issue | 🟡 Minor

deletedBy 파라미터에 대한 null 체크 누락

이전 구현에서는 StringUtils 기반의 빈 값 처리와 SYSTEM 기본값 로직이 있었습니다. 현재 구현에서는 deletedBynull로 전달될 경우 감사 필드가 null로 설정됩니다.

🛡️ null 체크 추가 제안
 protected void delete(UUID deletedBy) {
     // 중복 삭제로 인해 삭제 관련 필드가 업데이트되는 상황을 방지
     if (isDeleted()) {
         return;
     }
+    if (deletedBy == null) {
+        throw new IllegalArgumentException("deletedBy cannot be null");
+    }
         
     this.updatedBy = deletedBy;
     this.deletedBy = deletedBy;

     this.updatedAt = LocalDateTime.now();
     this.deletedAt = LocalDateTime.now();
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/main/java/com/fhsh/daitda/domain/BaseUserEntity.java` around lines 29 -
40, delete(UUID deletedBy) 메서드에서 deletedBy가 null일 경우 감사 필드가 null로 설정되는 문제가 있으니
null 검사 및 기본값 할당 로직을 추가하세요: BaseUserEntity 클래스에 존재하는 SYSTEM 상수(또는 기존 프로젝트의 시스템
유저 식별자)를 사용해 deletedBy가 null이면 SYSTEM으로 대체한 후 this.updatedBy/this.deletedBy에
할당하도록 수정하고, 기존 isDeleted() 체크와 시간 업데이트 로직은 그대로 유지하세요.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/main/java/com/fhsh/daitda/domain/BaseUserEntity.java`:
- Around line 19-26: Add JPA auditing configuration so
`@CreatedBy/`@LastModifiedBy populate createdBy/updatedBy: create a configuration
class named JpaAuditingConfig annotated with `@Configuration` and
`@EnableJpaAuditing` that declares a Bean auditorProvider returning an
AuditorAware<UUID> (e.g., using a getCurrentUserUUID() helper that reads the
current principal from SecurityContext); ensure this bean name and type are
available so the JPA auditing infrastructure can inject auditors for the
createdBy and updatedBy fields.
- Around line 46-57: Add null checks for the UUID parameters in both
delete(UUID) and restore(UUID): validate that the incoming restoredBy/deletedBy
is not null and throw an appropriate unchecked exception (e.g.,
IllegalArgumentException or NullPointerException) with a clear message when null
is passed; update BaseUserEntity.restore(UUID restoredBy) to perform the same
null validation as BaseUserEntity.delete(UUID deletedBy) before mutating
updatedBy/deletedBy/updatedAt/deletedAt. Also make the method access modifiers
consistent—either change restore to protected to match delete or change delete
to public—so both methods use the same visibility (follow existing design and
prefer making restore protected if delete is protected).

---

Outside diff comments:
In `@src/main/java/com/fhsh/daitda/domain/BaseUserEntity.java`:
- Around line 29-40: delete(UUID deletedBy) 메서드에서 deletedBy가 null일 경우 감사 필드가
null로 설정되는 문제가 있으니 null 검사 및 기본값 할당 로직을 추가하세요: BaseUserEntity 클래스에 존재하는 SYSTEM
상수(또는 기존 프로젝트의 시스템 유저 식별자)를 사용해 deletedBy가 null이면 SYSTEM으로 대체한 후
this.updatedBy/this.deletedBy에 할당하도록 수정하고, 기존 isDeleted() 체크와 시간 업데이트 로직은 그대로
유지하세요.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 772b48ab-9729-40db-b030-ddb1a610465d

📥 Commits

Reviewing files that changed from the base of the PR and between 1fd40f2 and a39074c.

📒 Files selected for processing (2)
  • build.gradle
  • src/main/java/com/fhsh/daitda/domain/BaseUserEntity.java

Comment thread src/main/java/com/fhsh/daitda/domain/BaseUserEntity.java
Comment thread src/main/java/com/fhsh/daitda/domain/BaseUserEntity.java
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.

[fix] Change the audit field to UUID

1 participant