Skip to content

REFACTOR: 캐릭터 도메인 정리 및 캐릭터 수정 API 구현#55

Merged
philbae0 merged 11 commits into
developfrom
refactor/#54
Jul 22, 2026
Merged

REFACTOR: 캐릭터 도메인 정리 및 캐릭터 수정 API 구현#55
philbae0 merged 11 commits into
developfrom
refactor/#54

Conversation

@philbae0

@philbae0 philbae0 commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • 캐릭터 도메인 리팩토링 및 정보 수정 API 추가

Related Issue

Describe your code

작업 내용 (What I Did) : 구현한 기능의 요약 설명 작성

  • Member/Term 도메인과 컨벤션 통일
  • 프리셋 이미지 공용 API 적용
  • 발견된 중복/비일관 요소 정리
  • 캐릭터 정보 수정 API 구현

스크린샷/결과 (Optional) : API 테스트 결과 첨부
(로컬에서 캐릭터 API 테스트 완료)


논의사항/질문 (To Reviewers) : 리뷰어들이 집중해서 봐주었으면 하는 부분 기술

  • 활성 캐릭터 전환 조건에 "메인으로 지정된 후 3일간 전환 불가" 로직이 있는데, 최초 캐릭터를 생성하면 자동으로 메인 지정되면서 그 순간부터 3일 카운트가 시작됩니다. 그래서 캐릭터를 만든 당일에는 다른 캐릭터로 전환이 항상 막히는 상태입니다. 최초 생성 시 메인으로 지정되는 것은 예외로 두고, 사용자가 전환 API를 연속으로 3일 내로 호출하는 것만 막는 게 맞을까요?

## Checklist - [ ] 리뷰어 등록

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7514a299-c5a7-4907-b570-0339b1f98c02

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/#54

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.

@github-actions

Copy link
Copy Markdown

🛡️ Issues

  • CharacterController에서 @AuthenticationPrincipal Long memberId를 사용하는 경우, Spring Security는 UserDetails principal을 주입하므로, 커스텀 리졸버가 등록되지 않으면 런타임 타입 불일치가 발생합니다.
  • TermService.hasAgreedAllRequiredTerms는 스트림 내에서 각 필수 약관에 대해 반복적으로 데이터베이스 조회를 실행하여 N+1 쿼리 문제를 발생시킵니다.

💡 Improvements

  • 반복문 내에서 쿼리를 실행하는 대신, SQL IN 또는 JOIN 절을 사용하여 사용자가 동의한 약관을 단일 데이터베이스 쿼리로 일괄 조회하세요.
  • 혼동을 피하기 위해 charactermember 도메인 간의 Job enum 값을 일치시키세요. 현재 하나는 EMPLOYED를, 다른 하나는 EMPLOYEE를 사용합니다.
  • 가독성과 단일 책임 원칙 준수를 위해 CharacterService의 캐릭터 특성 교체 로직을 별도의 헬퍼 메서드로 위임하세요.

@seokMini-2 seokMini-2 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다!! 리뷰 한 번 확인해주세요! 그리고 남겨주신 첫번째 질문 같은 경우는 pm님께 직접 여쭤보는 편이 좋을 것 같습니다!

LocalDateTime lastMessageAt = chatRoomRepository.findByRelationshipId(relationship.getId())
.map(ChatRoom::getLastMessageAt)
.orElse(null);
int daysTogether = (int) ChronoUnit.DAYS.between(relationship.getStartedAt(), LocalDate.now()) + 1;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아래 빌더에 이걸 활용한 dday 세팅하는건 빠져있는거 같은데, 맞을까요??

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

앗 빌더에 안 넣었네요 감사합니다

CHARACTER_DELETE_TOO_SOON(HttpStatus.BAD_REQUEST, "CHARACTER400_7", "캐릭터 생성 후 24시간이 지나야 삭제할 수 있습니다."),
INVALID_TRAIT_SELECTION(HttpStatus.BAD_REQUEST, "CHARACTER400_8", "매력 키워드와 우선순위는 중복될 수 없고 1부터 연속되어야 합니다.");
INVALID_TRAIT_SELECTION(HttpStatus.BAD_REQUEST, "CHARACTER400_8", "매력 키워드와 우선순위는 중복될 수 없고 1부터 연속되어야 합니다."),
CHARACTER_ALREADY_EDITED(HttpStatus.BAD_REQUEST, "CHARACTER400_9", "캐릭터 정보는 최초 1회만 수정할 수 있습니다.");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이게 캐릭터를 삭제하게 되었을때도, 수정된거로 될텐데, 캐릭터를 24시간 이내에 재생성할 수 없는 에러가 터지지 않을까요?? 해당 부분이 고려되었는지 궁금합니다!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

넵 따로 분리된 거라 영향 없습니다

@github-actions

Copy link
Copy Markdown

개선 사항

  • CharacterService에서 주석 처리된 삭제 제한 로직을 제거하여 프로덕션 코드를 깔끔하게 유지하세요.
  • DTO 확장(CharacterUpdateRequestCharacterCreateRequest를 확장하는 방식)을 피하여 생성 규칙이 나중에 달라질 경우 예기치 않은 스키마 결합을 방지하세요.
  • charactermember 도메인에 걸쳐 중복된 Job enum을 통합하여 불필요한 코드를 제거하세요.

@philbae0
philbae0 merged commit 528284c into develop Jul 22, 2026
1 of 2 checks passed
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.

♻️[REFACTOR] 캐릭터 도메인 정리

2 participants