Skip to content

Conversation

@rlajm1203
Copy link
Contributor

@rlajm1203 rlajm1203 commented Sep 24, 2025

📌 관련 이슈

✒️ 작업 내용

  • 캘린더 생성/수정 권한을 부서를 기준으로 검증합니다.

스크린샷 🏞️ (선택)

💬 REVIEWER에게 요구사항 💬

Summary by CodeRabbit

  • 버그 수정

    • 캘린더 일정 수정 시 작성자의 부서를 기준으로 권한을 일관되게 검증하여, 권한이 없는 수정 시도가 차단됩니다.
    • 잘못된 권한 처리로 인한 일부 수정 실패/허용 오류를 방지했습니다.
  • 리팩터링

    • 캘린더 유형과 부서에 따른 수정 가능 여부 판단 로직을 단일 경로로 통합해 일관성과 안정성을 개선했습니다.
    • 권한 검증 흐름을 정비해 향후 유지보수와 확장성을 높였습니다.

@rlajm1203 rlajm1203 self-assigned this Sep 24, 2025
@rlajm1203 rlajm1203 added the bug Something isn't working label Sep 24, 2025
@coderabbitai
Copy link

coderabbitai bot commented Sep 24, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

의존성 주입 방식으로 MemberRepository를 도입하고, 생성자에서 초기 상태를 설정하도록 변경했습니다. 권한 판단 로직을 isWritable(CalendarType, Department)로 통합했으며, updateValidatetypeValidate가 이를 사용하도록 수정되었습니다. 무인자 생성자가 제거되었습니다.

Changes

Cohort / File(s) Summary of changes
Validator 리팩터링 및 권한 체크 통합
eeos/src/main/java/.../calendar/application/validator/CalendarValidator.java
- MemberRepository 생성자 주입 및 필드 추가
- 무인자 생성자 제거, 생성자에서 AVAILABLE 초기화
- isWritable(CalendarType, Department) 헬퍼 추가
- updateValidate: 작성자 부서 조회 후 isWritable로 검증, 불가 시 DeniedCalendarUpdateException 발생
- typeValidate: 부서 집합 직접 검사 제거, isWritable 호출로 대체

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Client as Client
  participant Validator as CalendarValidator
  participant Repo as MemberRepository

  Client->>Validator: updateValidate(calendarId, writerId, type, ...)
  Validator->>Repo: findById(writerId)
  Repo-->>Validator: Member(department)
  Validator->>Validator: isWritable(type, department)?
  alt Writable
    Validator-->>Client: proceed (validation passes)
  else Not writable
    Validator-->>Client: throw DeniedCalendarUpdateException
  end
Loading
sequenceDiagram
  autonumber
  actor Client as Client
  participant Validator as CalendarValidator

  Client->>Validator: typeValidate(type, memberDepartment)
  Validator->>Validator: isWritable(type, memberDepartment)?
  alt Writable
    Validator-->>Client: OK
  else Not writable
    Validator-->>Client: validation error
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • Daae-Kim
  • kssumin

Poem

귀 깜빡, 콩콩 뛰며 코드를 살펴보니,
권한의 길 하나로 쭉—isWritable이 인도하네.
창고(MemberRepository)에서 부서를 꺼내 보고,
못 쓰면 툭, 예외 톡! 규칙은 또렷하게.
토끼는 끄덕, “검증의 숲이 훨씬 맑아졌군!” 🐇✨

✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch BM/hotfix/calendar-validate

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 45fa388 and 4ac0bd6.

📒 Files selected for processing (1)
  • eeos/src/main/java/com/blackcompany/eeos/calendar/application/validator/CalendarValidator.java (4 hunks)

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.

@github-actions
Copy link

Test Results

101 tests  ±0   98 ✅ ±0   5s ⏱️ ±0s
 40 suites ±0    3 💤 ±0 
 40 files   ±0    0 ❌ ±0 

Results for commit 4ac0bd6. ± Comparison against base commit 45fa388.

@rlajm1203 rlajm1203 merged commit 6748454 into develop Sep 24, 2025
2 of 3 checks passed
@rlajm1203 rlajm1203 deleted the BM/hotfix/calendar-validate branch September 24, 2025 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants