Skip to content

[WTH-504] 페널티 갯수 오류 수정 - #105

Open
woneeeee wants to merge 8 commits into
devfrom
fix/WTH-504-페널티-갯수-오류-수정

Hidden character warning

The head ref may contain hidden characters: "fix/WTH-504-\ud398\ub110\ud2f0-\uac2f\uc218-\uc624\ub958-\uc218\uc815"
Open

woneeeee wants to merge 8 commits into
devfrom
fix/WTH-504-페널티-갯수-오류-수정

Conversation

@woneeeee

@woneeeee woneeeee commented Sep 14, 2026

Copy link
Copy Markdown
Member

📌 Summary

어떤 작업인지 한 줄 요약해 주세요.

경고 2회 누적 시 페널티 자동 생성 멤버 목록/상세에 경고 횟수 노출, 어드민 멤버 검색에 역할 필터 추가, 탈퇴·추방 멤버 정렬 수정, 페널티 score 필드 제거, QueryService 트랜잭션 컨벤션 정리를 진행합니다.

📝 Changes

변경사항을 what, why, how로 구분해 작성해 주세요.

What

  • 경고(WARNING)가 threshold(2회) 누적되어 자동으로 패널티 1회로 전환될 때, 실제 Penalty row("누적경고 2회")가 생성되어 페널티 조회 API에 노출되도록 수정
  • 멤버 목록(GET /admin/clubs/{clubId}/members)·상세(GET /admin/clubs/{clubId}/members/{clubMemberId}) 응답(ClubMemberResponse)에 warningCount 필드 추가
  • 어드민 멤버 목록/검색 API(GET /admin/clubs/{clubId}/members, .../members/search)에 memberRole 필터 파라미터 추가
  • 어드민 멤버 목록에서 BANNED·LEFT 멤버가 선택한 정렬 옵션과 무관하게 항상 맨 뒤에 오도록 수정
  • 페널티 score(점수) 필드를 요청/응답 DTO, Penalty 엔티티, DB 컬럼까지 전부 제거 — 페널티/경고는 항상 1점씩 만부여됨
  • QueryService 클래스들의 @Transactional(readOnly = true)를 컨벤션대로 클래스 레벨로 통일 (메서드 레벨
    누락·중복 정리)

Why

  • 기존에는 경고 2회 자동전환 시 ClubMember.penaltyCount만 증가하고 실제 Penalty row가 생성되지 않아, 페널티 개수(카운터)와 페널티 조회 목록의 건수가 서로 달라지는 문제가 있었음
  • 어드민이 멤버의 경고 현황을 목록/상세에서 바로 확인할 수 있어야 하는데 warningCount가 응답에 없었음
  • 어드민 멤버 검색에서 이름·학과·학번은 이미 지원됐지만 역할(memberRole) 필터만 빠져 있어, 요청받은 필터 조건을 마저 채움
  • 어드민이 활동 중인 멤버를 먼저 보고 싶은데, 탈퇴·추방 멤버가 정렬 기준에 따라 목록 중간에 섞여 나와 관리 화면에서 불편했음
  • 페널티 점수가 실제로는 항상 1점만 부여되는 구조라, 점수를 입력/수정 가능한 필드로 남겨두는 게 불필요한 복잡도였음 (프론트에서도 해당 입력을 제거함)
  • QueryService는 전부 읽기 전용이어야 한다는 컨벤션이 일부 클래스에서 메서드 레벨로 흩어져 있거나 중복돼 있어
    일관성이 깨져 있었음

How

  • ClubMember.incrementWarningCount()가 전환 발생 횟수를 반환하도록 변경, SavePenaltyUseCase에서 그 횟수만큼 PenaltyMapper.toAutoConvertedPenalty()로 생성한 자동전환 Penalty를 저장
  • ClubMapper.toMemberResponse()에서 club.warningEnabled가 true일 때만 warningCount를 채워 반환 (mypage API와 동일한 규칙)
  • ClubMemberRepository.findAdminMembers() JPQL에 (:memberRole IS NULL OR cm.memberRole = :memberRole) 조건 추가, 컨트롤러/서비스/Reader 시그니처에 memberRole 파라미터 전달
  • 같은 JPQL의 ORDER BY 맨 앞에 CASE WHEN memberStatus IN (BANNED, LEFT) THEN 1 ELSE 0 END ASC 조건을 추가해 상태 우선순위를 모든 정렬 옵션보다 먼저 적용
  • Penalty 엔티티·요청/응답 DTO에서 score 제거, Flyway 마이그레이션(V15)으로 penalty.score 컬럼 drop.ClubMember.incrementPenaltyCount()/incrementWarningCount()는 항상 +1, 삭제 시에는 기존decrementPenaltyCount()/decrementWarningCount()로 -1. 더 이상 쓰이지 않는 adjustPenaltyCount/adjustWarningCount, UpdatePenaltyUseCase`의 점수 조정 로직은 삭제
  • GetUserProfileQueryService, GetUserProfileAssignableClubQueryService, GetUserMyPageQueryService,GetUserAttendanceQueryService의 메서드 레벨 @Transactional(readOnly = true)를 클래스 레벨로 이동, GetUserPostQueryService의 중복 애너테이션 제거

📸 Screenshots / Logs

필요시 스크린샷 or 로그를 첨부해주세요.

💡 Reviewer 참고사항

리뷰에 참고할 내용을 작성해주세요.

✅ Checklist

  • PR 제목 설정 완료 (WTH-123 인증 필터 설정)
  • 테스트 구현 완료
  • 리뷰어 등록 완료
  • 자체 코드 리뷰 완료

woneeeee and others added 3 commits September 14, 2026 21:07
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LSnYQGCPrqJBzJRuVVJHCm
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LSnYQGCPrqJBzJRuVVJHCm
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LSnYQGCPrqJBzJRuVVJHCm
@woneeeee
woneeeee requested review from hyxklee and soo0711 September 14, 2026 12:14
@woneeeee woneeeee self-assigned this Sep 14, 2026
@woneeeee woneeeee added the 🐞 BugFix 버그 수정 label Sep 14, 2026
@coderabbitai

coderabbitai Bot commented Sep 14, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 2e752440-3c88-42d6-98c4-435a05e81c5c


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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 BugFix 버그 수정

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant