feat: Admin 기능 구현 (가입 승인/반려/정지/탈퇴, 게시글/댓글 삭제) - #7
Open
Je-hye wants to merge 3 commits into
Open
Conversation
This reverts commit 1d36993.
각 어노테이션(@transactional, @PathVariable, @RequestBody 등)과 JPA Dirty Checking, 소프트 삭제, SecurityUtil 동작 원리 설명 포함. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
DTO(record, @notblank), Repository(Query Method 명명 규칙), 공통 인프라(ApiResponse, ErrorCode, GlobalExceptionHandler, JpaConfig) 포함. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
구현 내용
Admin API 8개 전체 구현 (TDD 적용).
GET /api/admin/users/pending— 가입 대기 회원 목록 (페이지네이션)GET /api/admin/users/{userId}— 회원 상세 조회 (postCount, commentCount 포함)PATCH /api/admin/users/{userId}/approve— 가입 승인PATCH /api/admin/users/{userId}/reject— 가입 반려 (사유 저장)DELETE /api/admin/posts/{postId}— 게시글 소프트 삭제DELETE /api/admin/comments/{commentId}— 댓글 소프트 삭제PATCH /api/admin/users/{userId}/ban— 회원 정지 (7일 고정, UserSanction 이력 저장)DELETE /api/admin/users/{userId}— 강제 탈퇴 (UserSanction FORCE_WITHDRAW 이력 저장)포함된 공통 인프라
아직 다른 브랜치에 merge 안 된 공통 코드가 포함되어 있어요. 중복 충돌 주의:
common/dto/ApiResponse.java— 공통 응답 래퍼common/exception/CustomException.java,ErrorCode.java,GlobalExceptionHandler.javaconfig/JpaConfig.java—@EnableJpaAuditing분리 (@WebMvcTest충돌 방지)domain/user/repository/추가 —AdminRepository,UserRejectionRepository,UserSanctionRepositorydomain/post/repository/추가 —PostRepository,CommentRepository설계 결정 사항 (팀 논의 필요)
ApiResponse<T>사용, auth는 raw DTO 반환 — 팀 전체 통일 방향 논의 필요UserStatus에WITHDRAWN없어서BANNED상태로 저장,user_sanctions에서FORCE_WITHDRAW타입으로 구분 — ERD 확인 필요테스트
AdminControllerTest—@WebMvcTest슬라이스 테스트 (MockMvc)AdminServiceTest—@ExtendWith(MockitoExtension)단위 테스트Test Plan
JAVA_HOME=/opt/homebrew/Cellar/openjdk@17/17.0.18/libexec/openjdk.jdk/Contents/Home ./gradlew testPOST /api/auth-test/create-admin으로 어드민 계정 생성 후 JWT 발급🤖 Generated with Claude Code