Skip to content

Feat: [FN-301] 그룹 삭제 API 구현 #5

Merged
stoneTiger0912 merged 6 commits intomainfrom
feat/delete-group
Feb 13, 2026
Merged

Feat: [FN-301] 그룹 삭제 API 구현 #5
stoneTiger0912 merged 6 commits intomainfrom
feat/delete-group

Conversation

@stoneTiger0912
Copy link
Member

@stoneTiger0912 stoneTiger0912 commented Feb 11, 2026

Summary by CodeRabbit

릴리스 노트

  • 새로운 기능
    • 그룹 삭제 기능이 추가되었습니다. 사용자는 이제 그룹을 삭제하면 삭제가 즉시 적용되며 성공 시 응답 코드 204를 받습니다.
  • 추가/정비
    • 그룹 멤버 관리 관련 엔드포인트 골격(요청/초안)이 추가되어 향후 멤버 초대, 요청, 승인/거절, 삭제 기능이 이어서 구현될 예정입니다.

@stoneTiger0912 stoneTiger0912 self-assigned this Feb 11, 2026
@coderabbitai
Copy link

coderabbitai bot commented Feb 11, 2026

Caution

Review failed

The pull request is closed.

Walkthrough

그룹 삭제 기능이 추가되었습니다: API 엔드포인트(@DeleteMapping), 입력 커맨드(DeleteGroupCommand), 사용 사례 인터페이스(DeleteGroupUseCase) 및 구현(DeleteGroupService), 저장소 포트에 delete 메서드 추가와 어댑터 구현이 포함됩니다. 멤버 관련 컨트롤러 스텁도 추가되었습니다.

Changes

Cohort / File(s) Summary
API 엔드포인트
src/main/java/flipnote/group/adapter/in/web/GroupController.java
@DeleteMapping("/{groupId}") 엔드포인트 추가: X-USER-ID 헤더와 groupId 경로를 받아 DeleteGroupCommand 생성 후 deleteGroupUseCase.deleteGroup(cmd) 호출, HTTP 204 반환.
컨트롤러 스텁
src/main/java/flipnote/group/adapter/in/web/MemberController.java
그룹 멤버 관리용 플레이스홀더 컨트롤러 추가(주석 TODO, 구현 없음).
포트 및 커맨드 정의
src/main/java/flipnote/group/application/port/in/DeleteGroupUseCase.java, src/main/java/flipnote/group/application/port/in/command/DeleteGroupCommand.java
DeleteGroupUseCase 인터페이스와 DeleteGroupCommand(userId, groupId) 레코드 추가.
애플리케이션 서비스
src/main/java/flipnote/group/application/service/DeleteGroupService.java
DeleteGroupUseCase 구현 클래스 추가: groupRepository.delete(cmd.groupId())를 호출하며 메서드는 @Transactional로 표시.
저장소 포트 및 어댑터
src/main/java/flipnote/group/application/port/out/GroupRepositoryPort.java, src/main/java/flipnote/group/adapter/out/persistence/GroupRepositoryAdapter.java
포트에 void delete(Long id) 추가 및 어댑터에 delete(Long groupId) 구현(존재 확인 후 groupRepository.deleteById).

Sequence Diagram(s)

sequenceDiagram
    participant Client as Client
    participant Controller as GroupController
    participant Service as DeleteGroupService
    participant RepoPort as GroupRepositoryPort
    participant DB as JPARepository

    Client->>Controller: DELETE /groups/{groupId} (X-USER-ID)
    Controller->>Service: deleteGroup(DeleteGroupCommand(userId, groupId))
    Service->>RepoPort: delete(groupId)
    RepoPort->>DB: existsById(groupId) / deleteById(groupId)
    DB-->>RepoPort: ack
    RepoPort-->>Service: ack
    Service-->>Controller: completed
    Controller-->>Client: 204 No Content
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

개요

그룹 삭제 기능이 구현되었습니다. 클린 아키텍처의 각 계층을 따라 DeleteGroupUseCase 인터페이스, DeleteGroupCommand 레코드, DeleteGroupService 구현, 그리고 GroupController의 새로운 엔드포인트가 추가되었으며, 저장소 포트와 어댑터도 확장되었습니다.

변경 사항

Cohort / File(s) 요약
API 엔드포인트
src/main/java/flipnote/group/adapter/in/web/GroupController.java
새로운 deleteGroup 엔드포인트 추가 (@DeleteMapping("/{groupId}")). 헤더에서 사용자 ID, 경로에서 그룹 ID를 받아 DeleteGroupCommand를 구성하고 사용 사례를 호출한 후 HTTP 204를 반환합니다.
컨트롤러 스텁
src/main/java/flipnote/group/adapter/in/web/MemberController.java
멤버 관리 작업을 위한 플레이스홀더 TODO 주석이 포함된 새로운 공개 클래스 추가 (아직 구현되지 않음).
사용 사례 및 커맨드 정의
src/main/java/flipnote/group/application/port/in/DeleteGroupUseCase.java, src/main/java/flipnote/group/application/port/in/command/DeleteGroupCommand.java
DeleteGroupUseCase 인터페이스와 DeleteGroupCommand 레코드 추가. 커맨드는 userIdgroupId 필드를 정의합니다.
애플리케이션 서비스 구현
src/main/java/flipnote/group/application/service/DeleteGroupService.java
DeleteGroupUseCase를 구현하는 새로운 서비스 클래스. GroupRepositoryPort에 위임하여 삭제 로직을 처리합니다.
저장소 포트 및 어댑터
src/main/java/flipnote/group/application/port/out/GroupRepositoryPort.java, src/main/java/flipnote/group/adapter/out/persistence/GroupRepositoryAdapter.java
GroupRepositoryPort 인터페이스에 void delete(Long id) 메서드 추가. GroupRepositoryAdapter에서 이를 구현하여 존재 확인 후 groupRepository.deleteById(groupId)로 위임합니다.

예상 코드 검토 시간

🎯 3 (Moderate) | ⏱️ ~20 minutes

관련 가능성 있는 PR

  • Feat: [FN-297] 그룹 조회 API 구현  #2: 이 PR과 동일하게 GroupControllerGroupRepositoryPort/GroupRepositoryAdapter 클래스를 수정하여 새로운 그룹 생명주기 작업(이 PR은 삭제, 다른 PR은 조회/변경)을 추가하므로 동일한 클래스 및 저장소 포트/어댑터 인터페이스를 건드립니다.

🐰 그룹을 지우는 길, 깔끔히 지나가네,
커맨드 한 송이 들고 서비스가 달리고,
포트와 어댑터가 손을 맞잡아,
컨트롤러는 204를 건네주네,
작은 삭제, 큰 정리, 햇살 같은 배포!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 22.22% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 제목이 변경 사항의 주요 내용을 명확하게 반영하고 있습니다. 그룹 삭제 API 구현이라는 목표가 제목에 잘 드러나 있습니다.

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

✨ 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 feat/delete-group

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

🤖 Fix all issues with AI agents
In `@src/main/java/flipnote/group/adapter/in/web/GroupController.java`:
- Around line 118-136: Fix the typo in the TODO comment inside GroupController
(in the deleteGroup method of class GroupController): change both occurrences of
"권환" to "권한" so the TODO reads correctly (e.g., "추후 권한 체크 후 권한 확인 후 삭제"),
preserving the comment structure and spacing.

In
`@src/main/java/flipnote/group/adapter/out/persistence/GroupRepositoryAdapter.java`:
- Around line 39-42: The delete method in GroupRepositoryAdapter currently calls
groupRepository.deleteById(groupId) without checking existence, which is
inconsistent with findById's behavior; update GroupRepositoryAdapter.delete(Long
groupId) to first verify the group exists (e.g., use
groupRepository.existsById(groupId) or reuse findById logic) and if not present
throw the same IllegalArgumentException used elsewhere, otherwise call
groupRepository.deleteById(groupId) to perform the deletion so behavior and
client responses remain consistent.

In `@src/main/java/flipnote/group/application/service/DeleteGroupService.java`:
- Around line 10-19: Add transactional and ownership checks to
DeleteGroupService: annotate the class or deleteGroup method with
`@Transactional`, load the group via GroupRepositoryPort (e.g., findById or
getById) inside deleteGroup(DeleteGroupCommand cmd), verify that the fetched
group's ownerId equals cmd.userId, and if not throw an appropriate
access/authorization exception; only call groupRepository.delete(cmd.groupId())
after the existence and ownership checks succeed (and handle group-not-found by
throwing a not-found exception).
🧹 Nitpick comments (2)
src/main/java/flipnote/group/adapter/in/web/MemberController.java (1)

1-18: 스캐폴딩 전용 컨트롤러가 메인 브랜치에 병합됩니다.

이 파일은 구현이 전혀 없이 TODO 주석만 포함된 빈 클래스입니다. 그룹 삭제 API PR의 범위에 포함될 필요가 없어 보이며, 해당 기능을 실제 구현할 때 추가하는 것이 더 적절합니다.

만약 의도적으로 포함시킨 것이라면, 최소한 @RestController@RequestMapping 어노테이션을 미리 추가하는 것을 권장합니다.

src/main/java/flipnote/group/application/service/DeleteGroupService.java (1)

17-18: 소프트 삭제(Soft Delete) 고려 필요

현재 물리적 삭제(deleteById)를 수행하고 있습니다. 그룹에 속한 멤버, 노트 등 연관 데이터가 있을 경우 데이터 정합성 문제가 발생할 수 있습니다. 소프트 삭제(deleted 플래그 또는 deletedAt 타임스탬프) 도입을 검토해 보세요. 당장이 아니더라도 아키텍처 방향 결정이 필요한 사항입니다.

@stoneTiger0912 stoneTiger0912 merged commit a4cd309 into main Feb 13, 2026
1 check was pending
@stoneTiger0912 stoneTiger0912 deleted the feat/delete-group branch February 13, 2026 13:40
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.

1 participant