Skip to content

Conversation

@stoneTiger0912
Copy link
Member

@stoneTiger0912 stoneTiger0912 commented Feb 9, 2026

Summary by CodeRabbit

  • 새로운 기능
    • 그룹 정보 수정 기능 추가 — 그룹 이름, 카테고리, 설명, 참여 정책, 가시성, 최대 회원수 및 이미지 변경 가능 (PUT /v1/groups/{groupId}).
    • 그룹 생성 시 및 수정 시점을 저장하여 생성/수정 시간 표시가 가능해졌습니다.
  • 유효성 검사
    • 그룹 수정 요청에 대한 입력 유효성(빈값, 범위 등) 검증이 추가되었습니다.

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

coderabbitai bot commented Feb 11, 2026

Caution

Review failed

The pull request is closed.

Walkthrough

그룹 수정(Change Group) 기능이 추가되었습니다. 컨트롤러에 PUT 엔드포인트가 추가되고, ChangeGroupUseCase/ChangeGroupCommand/ChangeGroupService가 도입되며 영속성 계층에 조회(findById)·업데이트(update)와 매핑(toDomain)이 추가되었습니다. 도메인에는 createdAt/modifiedAt 필드가 추가되었습니다.

변경사항

Cohort / File(s) 요약
컨트롤러·API DTO
src/main/java/flipnote/group/adapter/in/web/GroupController.java, src/main/java/flipnote/group/api/dto/request/ChangeGroupRequestDto.java, src/main/java/flipnote/group/api/dto/response/ChangeGroupResponseDto.java
PUT /v1/groups/{groupId} 엔드포인트 추가, 요청/응답 DTO 추가 및 컨트롤러에 ChangeGroupUseCase 의존성 주입
애플리케이션 포트·커맨드·결과
src/main/java/flipnote/group/application/port/in/ChangeGroupUseCase.java, src/main/java/flipnote/group/application/port/in/command/ChangeGroupCommand.java, src/main/java/flipnote/group/application/port/in/result/ChangeGroupResult.java
새로운 ChangeGroupUseCase 인터페이스와 ChangeGroupCommand/ChangeGroupResult 타입 추가
서비스 레이어
src/main/java/flipnote/group/application/service/ChangeGroupService.java, src/main/java/flipnote/group/application/service/CreateGroupService.java
ChangeGroupService 추가(트랜잭션 처리, 엔티티 조회·변경), CreateGroupService 시그니처·내부 호출에서 userId를 명령에서 사용하도록 변경
영속성 어댑터·매퍼·엔티티
src/main/java/flipnote/group/adapter/out/persistence/GroupRepositoryAdapter.java, src/main/java/flipnote/group/adapter/out/persistence/mapper/GroupMapper.java, src/main/java/flipnote/group/adapter/out/entity/GroupEntity.java
findById()·update() 메서드 추가, GroupEntity.change(ChangeGroupCommand) 도입, GroupMapper.toDomain() 추가로 DB 엔티티↔도메인 매핑 확장
포트 변경
src/main/java/flipnote/group/application/port/out/GroupRepositoryPort.java, src/main/java/flipnote/group/application/port/in/CreateGroupUseCase.java
GroupRepositoryPort에 findById·update 시그니처 추가, CreateGroupUseCase.create에서 userId 인자 제거(커맨드로 이동)
도메인 모델
src/main/java/flipnote/group/domain/model/group/Group.java, src/main/java/flipnote/group/application/port/in/command/CreateGroupCommand.java
도메인에 createdAt/modifiedAt 필드 추가, getGroup()restore()로 복원 메서드명 변경, CreateGroupCommand에 userId 필드 추가

시퀀스 다이어그램

sequenceDiagram
    participant Client
    participant GroupController
    participant ChangeGroupService
    participant GroupRepositoryPort
    participant GroupEntityDB as GroupEntity(DB)
    participant GroupMapper

    Client->>GroupController: PUT /v1/groups/{groupId} + ChangeGroupRequestDto, X-USER-ID
    GroupController->>ChangeGroupService: change(ChangeGroupCommand)
    ChangeGroupService->>GroupRepositoryPort: findById(groupId)
    GroupRepositoryPort->>GroupEntityDB: SELECT GroupEntity by id
    GroupEntityDB-->>GroupRepositoryPort: GroupEntity
    GroupRepositoryPort-->>ChangeGroupService: GroupEntity

    ChangeGroupService->>GroupEntityDB: entity.change(cmd)
    GroupEntityDB-->>GroupRepositoryPort: 변경 반영 (영속성)
    GroupRepositoryPort-->>ChangeGroupService: 업데이트된 Group (매핑 전)
    ChangeGroupService->>GroupMapper: toDomain(updatedEntity)
    GroupMapper-->>ChangeGroupService: Group (도메인)
    ChangeGroupService-->>GroupController: ChangeGroupResult
    GroupController-->>Client: 200 OK + ChangeGroupResponseDto
Loading

예상 코드 리뷰 노력

🎯 3 (보통) | ⏱️ ~22분

관련 PR

🐰 새로운 길로 PUT을 달려가네,
이름과 설명, 설정들 함께 바꾸고,
타임스탬프는 지나온 발자국을 기억해,
엔티티는 조용히 변화를 받아들이고,
서비스와 컨트롤러가 손을 맞잡네.

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 55.56% 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 풀 리퀘스트 제목이 주요 변경사항과 완벽하게 일치합니다. 제목 '그룹 수정 API 구현'은 변경사항의 핵심인 ChangeGroup 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/change-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

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/flipnote/group/domain/model/group/Group.java (1)

14-92: ⚠️ Potential issue | 🔴 Critical

그룹 수정을 위한 도메인 메서드가 없습니다.

Group 도메인 모델에 create()restore()는 있지만, 변경 사항을 적용하는 메서드가 없습니다. 이로 인해 ChangeGroupService에서 command의 값을 도메인 객체에 반영할 수 없는 치명적 버그가 발생합니다. ChangeGroupCommand(또는 개별 파라미터)를 받아 필드를 갱신하고 유효성 검증을 수행하는 change() 메서드를 추가해야 합니다.

🤖 Fix all issues with AI agents
In `@src/main/java/flipnote/group/adapter/out/entity/GroupEntity.java`:
- Around line 81-94: The change(...) method currently accepts and assigns
memberCount, allowing external callers to overwrite a derived value; remove
memberCount from the change method signature and stop assigning this.memberCount
inside GroupEntity.change(...) so group edits cannot arbitrarily mutate
memberCount, and instead provide/keep dedicated methods (e.g.,
incrementMemberCount(), decrementMemberCount(), or adjustMemberCountBy(...))
that are the only ways to mutate memberCount if needed.

In `@src/main/java/flipnote/group/application/port/out/GroupRepositoryPort.java`:
- Line 5: The GroupRepositoryPort currently imports and depends on adapter-layer
GroupEntity; change the port to use the domain model only by removing the import
of flipnote.group.adapter.out.entity.GroupEntity and updating the interface
signatures so findById returns Optional<Group> and update accepts a domain Group
(or other domain types) instead of GroupEntity; move all Entity↔Domain mapping
logic into the repository adapter implementation (the class that implements
GroupRepositoryPort) so adapters handle conversion between GroupEntity and the
domain Group, keeping the application port free of adapter types.

In `@src/main/java/flipnote/group/application/service/ChangeGroupService.java`:
- Around line 30-41: The change method currently maps the DB entity to a domain
Group using GroupMapper.toDomain but never applies values from
ChangeGroupCommand (cmd) or checks cmd.userId(), so update persists unchanged
data; add a mutator on the domain model (e.g., Group.change(ChangeGroupCommand)
that applies name, category, description, joinPolicy, visibility, maxMember,
imageRefId and performs authorization/permission checks using cmd.userId(), then
in ChangeGroupService.change call GroupMapper.toDomain(groupEntity), invoke
domain.change(cmd) before calling groupRepository.update(domainGroup,
groupEntity) so the repository persists the updated state.
🧹 Nitpick comments (4)
src/main/java/flipnote/group/application/port/in/command/ChangeGroupCommand.java (1)

7-17: CreateGroupCommand와의 중복 필드가 많습니다.

ChangeGroupCommandCreateGroupCommandname, category, description, joinPolicy, visibility, maxMember, imageRefId 총 7개의 필드가 동일합니다. 현재 수준에서는 수용 가능하지만, 향후 필드가 추가되거나 변경될 때 두 커맨드를 동시에 수정해야 하는 부담이 생길 수 있으므로, 공통 필드를 별도의 record나 인터페이스로 추출하는 것을 고려해 볼 수 있습니다.

src/main/java/flipnote/group/adapter/out/persistence/GroupRepositoryAdapter.java (1)

31-34: GroupRepositoryPortGroupEntity를 반환하여 헥사고날 아키텍처 경계를 위반합니다.

findByIdOptional<GroupEntity>를 반환하면 application 포트가 adapter 계층의 영속성 엔티티에 의존하게 됩니다. 도메인 객체(Optional<Group>)를 반환하도록 변경하면 계층 분리를 유지할 수 있습니다. 다만, 현재 JPA dirty checking을 활용하기 위해 entity 참조가 필요한 구조이므로 즉시 변경이 어려울 수 있습니다.

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

8-9: Application 서비스에서 adapter 계층을 직접 참조합니다.

GroupEntityGroupMapper는 adapter 계층에 속하는데, application 서비스에서 직접 import하고 있어 헥사고날 아키텍처의 의존성 방향을 위반합니다. Port 인터페이스가 도메인 객체만 반환하도록 개선하면 이 의존성을 제거할 수 있습니다.

src/main/java/flipnote/group/domain/model/group/Group.java (1)

10-10: 사용되지 않는 lombok.Setter import가 남아있습니다.

@Setter 어노테이션이 클래스에서 제거되었으나 import는 남아있습니다.

@stoneTiger0912 stoneTiger0912 merged commit 6893225 into main Feb 11, 2026
1 check was pending
@stoneTiger0912 stoneTiger0912 deleted the feat/change-group branch February 11, 2026 14:09
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