Skip to content

#36 [Feat] user 도메인 리팩토링 및 마이페이지 API 구현#39

Open
Dante0922 wants to merge 20 commits intodevfrom
feat/#36
Open

#36 [Feat] user 도메인 리팩토링 및 마이페이지 API 구현#39
Dante0922 wants to merge 20 commits intodevfrom
feat/#36

Conversation

@Dante0922
Copy link
Contributor

@Dante0922 Dante0922 commented Mar 21, 2026

Summary

  • 불필요한 엔드포인트 제거 (bootstrap, onboarding, tendency-scores, public profile 등)
  • onboardingCompleted 필드 User 엔티티 + AuthService에서 완전 제거
  • UserSettings 필드 교체 (4개 → 6개 알림 설정 필드)
  • UserTendencyScore 필드 리네이밍 (score1~6 → principle/reason/individual/change/inner/ideal)
  • MypageController + MypageService 신규 구현 (9개 엔드포인트)
    • PATCH /me/profile — 프로필 수정
    • GET /me/mypage — 마이페이지 요약 (프로필 + 철학자 + 티어)
    • GET /me/recap — 상세 리캡 (성향 점수 + preferenceReport)
    • GET /me/battle-records — 배틀 기록 조회 (offset 페이지네이션, voteSide 필터)
    • GET /me/content-activities — 댓글/좋아요 활동 조회
    • GET/PATCH /me/notification-settings — 알림 설정 조회/수정
    • GET /me/notices, GET /me/notices/{noticeId} — 공지/이벤트 조회
  • 타 도메인 조회 로직을 VoteQueryService, PerspectiveQueryService, BattleQueryService로 분리
  • Notice 도메인 통합 및 user 내 중복 코드 제거
  • USER ERD 최신화 (user.puml, user-ops.puml)
  • 테스트케이스 추가: UserServiceTest(8건), MypageServiceTest(12건), HomeServiceTest(+2건), 기존 테스트 @DisplayName 통일

TODO (이후 작업)

  • 철학자 산출 로직 구현 (현재 SOCRATES 하드코딩)
  • 포인트 계산 로직 구현 (현재 0P 고정)
  • DB 마이그레이션 (user_settings 컬럼 교체, tendency_scores 컬럼명 변경, onboarding_completed 삭제)

Test plan

  • ./gradlew test 전체 테스트 통과 확인 (총 26건)
  • 삭제된 엔드포인트(/onboarding/bootstrap 등) 404 확인
  • PATCH /me/profile 정상 응답 확인
  • GET /me/mypage, /me/recap 응답 구조 확인
  • GET /me/battle-records offset 페이지네이션 + voteSide 필터 확인
  • GET /me/content-activities COMMENT/LIKE 분기 확인
  • GET/PATCH /me/notification-settings 조회/수정 확인
  • GET /me/notices, /me/notices/{id} 공지 조회 확인
  • ERD 다이어그램 렌더링 확인 (PlantUML)

Closes #36, Closes #40

🤖 Generated with Claude Code

Dante0922 and others added 15 commits March 21, 2026 12:36
- UserController, 불필요 DTO 11개, UserService 메서드 삭제
- User 엔티티에서 onboardingCompleted 필드/메서드 완전 제거
- AuthService 신규 유저 초기 status를 ACTIVE로 변경

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- MyProfileResponse에서 mannerTemperature 제거
- UserSettings 필드 교체 (4개 → 6개 알림 설정 필드)
- UserTendencyScore/History 필드 리네이밍 (score1~6 → principle/reason/individual/change/inner/ideal)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- PhilosopherType, TierCode, NoticeType, VoteSide, ActivityType enum 생성
- Notice 엔티티 및 NoticeRepository 생성
- 마이페이지 API Response/Request DTO 8개 생성

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- MyProfileResponse에서 mannerTemperature 제거
- UserSettings 필드 교체 (4개 → 6개 알림 설정 필드)
- UserTendencyScore/History 필드 리네이밍 (score1~6 → principle/reason/individual/change/inner/ideal)
- @column(name) 매핑 제거, DB 컬럼명도 새 필드명으로 통일

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- VoteRepository에 사용자 투표 기록 조회 쿼리 추가 (offset 페이지네이션, voteSide 필터)
- MypageService.getBattleRecords() 구현 (Vote → Battle 조인, BattleOptionLabel ↔ VoteSide 매핑)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- PerspectiveComment/LikeRepository에 사용자 활동 조회 쿼리 추가
- MypageService.getContentActivities() 구현 (COMMENT/LIKE 타입별 분기)
- Battle, BattleOption 배치 조회로 N+1 방지

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- VoteRepository에 recap 통계용 쿼리 추가 (사후투표 수, 입장변경 수, 전체 투표 조회)
- BattleTagRepository에 배치 태그 조회 쿼리 추가
- MypageService.getRecap() preferenceReport 구현
  - totalParticipation: 총 투표 참여 수
  - opinionChanges: 사전/사후 투표 옵션 불일치 수
  - battleWinRate: 사후 투표 중 다득표 옵션 선택 비율
  - favoriteTopics: 참여 배틀의 태그별 빈도 상위 4개

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- VoteQueryService 생성: 투표 기록 조회, 참여 통계, 승률 계산 로직 캡슐화
- PerspectiveQueryService 생성: 댓글/좋아요 활동 조회 로직 캡슐화
- BattleQueryService 생성: 배틀/옵션 배치 조회, 태그 빈도 집계 캡슐화
- MypageService에서 타 도메인 Repository 의존 모두 제거, QueryService만 호출

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Dante0922 Dante0922 self-assigned this Mar 21, 2026
@Dante0922 Dante0922 requested review from HYH0804, jucheonsu and si-zero and removed request for jucheonsu and si-zero March 21, 2026 05:09
Dante0922 and others added 4 commits March 21, 2026 14:22
user/entity/Notice, NoticeType, NoticeRepository를 삭제하고
notice 도메인의 NoticeService를 호출하도록 변경.
noticeId 타입을 Long → UUID로 통일.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- user.puml: onboarding_completed 제거, nickname/character_url 추가, SUSPENDED 상태 추가, tendency score 필드명 변경
- user-ops.puml: SUSPENDED 상태 추가, user_settings 필드 실제 엔티티와 일치하도록 교체
- UserServiceTest 8건, MypageServiceTest 12건 신규 추가
- HomeServiceTest 2건 추가

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- HomeServiceTest: 한글 메서드명 → 영문 + @DisplayName
- NoticeServiceTest: 한글 메서드명 → 영문 + @DisplayName

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jucheonsu jucheonsu added the ✨ Feat (기능 추가) 새로운 기능을 추가할 때 사용합니다. label Mar 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨ Feat (기능 추가) 새로운 기능을 추가할 때 사용합니다.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🔨 Chore: USER ERD 최신화 및 USER/HOME 테스트케이스 추가 ✨ Feat: 마이페이지 집계 API 및 사용자 기본 정책 정비

2 participants