-
Notifications
You must be signed in to change notification settings - Fork 0
Profile > 프로필 모듈 구현 #443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Profile > 프로필 모듈 구현 #443
Conversation
…terest` for mapping - `profile`: 사용자 프로필 상세 정보 저장하는 테이블 - `interest`: 사용자가 선택 가능한 관심사들을 관리하는 테이블 - `profile_interest`: `profile`과 `interest`를 연결하여 다대다 관계를 위해 추가한 테이블
…able - user_id FK, unique 제약조건 추가 - createdAt, updatedAt 컬럼 추가
- interest 테이블에 테스트 데이터를 삽입하는 R 스크립트 추가 - 관심사에는 백엔드, 프론트엔드, 안드로이드, ios 를 값으로 추가
- 사용자 프로필 관리 기능을 위한 profile 모듈 생성 - auth 모듈을 기반으로 각 서브 모듈 구성 및 의존성 추가
- profile 테이블 정의를 간소화하여, 이전 profile 테이블 생성 스크립트를 삭제함
…rofile schema - 프로필 관련 테이블들의 스키마를 auth에서 profile로 변경 - profile, profile_interest, interest 테이블
- Profile 도메인 정의 - 1인 1프로필 정책 적용 - 닉네임 미입력 시, 기본 닉네임 적용
- Profile, ProfileInterest, Interest 엔티티 정의 - 프로필과 해당 프로필의 관심사 DB 저장 - 도메인 객체와 엔티티 객체 간 변환을 위한 MapStruct 매퍼 추가
- 사용자 프로필 유무 조회를 위한 인가 객체 사용
- 메인 애플리케이션에 프로필 서비스 의존성 추가
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements a comprehensive profile service module for user profile management during registration. It includes database schema creation, domain models, and API endpoints for profile creation with support for skipping profile setup.
- Implements profile service module with database tables (profile, profile_interest, interest)
- Creates profile creation API endpoint for user registration flow
- Adds fallback mechanism for users who skip profile creation with auto-generated nicknames
Reviewed Changes
Copilot reviewed 37 out of 37 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
settings.gradle.kts | Adds profile service to build configuration |
services/profile/* | Creates complete profile service architecture with domain, application, and adapter layers |
monolith/main-runner/src/main/resources/db/migration/v1/* | Database migration scripts for profile-related tables |
ProfileCommandApi.java | REST controller for profile creation endpoint |
ProfileCommandService.java | Business logic for profile creation with nickname generation |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
services/profile/driven/rdb/src/main/java/nettee/profile/rdb/entity/InterestEntity.java
Outdated
Show resolved
Hide resolved
monolith/main-runner/src/main/resources/db/migration/dummy/R__init_dummies.sql
Show resolved
Hide resolved
- flyway 스크립트 버전 순서에 맞게 파일명 시퀀스를 수정함 - FK, UK 제약조건 삭제
- 프로필 생성 시, profile ID를 반환하도록 함 - 회원가입 jwt 클레임에 저장 - 프로필 닉네임은 회원가입 시, 입력한 username으로 설정
- 사용자의 userId를 기준으로 profileId 조회
- 로그인 및 jwt 재발행 시, profileId를 클레임에 담기 위한 API 추가
…rnal api - 회원가입, 로그인 시 호출되는 프로필 API를 내부 서버 전용인 internal 엔드포인트로 분리 - 내부 서버 간의 통신이므로 요청에 jwt 토큰을 포함하지 않는 방향으로 수정
- 회원가입, 로그인 시 프로필 생성 및 조회 API 호출 - 발급되는 jwt 토큰 클레임에는 profileId가 포함되도록 수정 - 신규 가입자의 경우, 프로필이 자동으로 생성
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 38 out of 38 changed files in this pull request and generated 4 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
services/profile/driven/rdb/src/main/java/nettee/profile/rdb/entity/key/ProfileInterestId.java
Show resolved
Hide resolved
for (String interest : profile.getInterests()) { | ||
Long profileId = profileEntity.getId(); |
Copilot
AI
Sep 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The profileId is retrieved inside the loop on each iteration, but it remains constant. Move Long profileId = profileEntity.getId();
outside the loop to avoid redundant calls.
for (String interest : profile.getInterests()) { | |
Long profileId = profileEntity.getId(); | |
Long profileId = profileEntity.getId(); | |
for (String interest : profile.getInterests()) { |
Copilot uses AI. Check for mistakes.
// 6. 프로필 서버에 프로필 생성 요청 | ||
ProfileCreateModel profileBody = new ProfileCreateModel( | ||
userEntity.getId(), | ||
model.username(), |
Copilot
AI
Sep 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Using model.username()
as the nickname might be confusing since username is typically different from nickname. Consider using a more descriptive variable name or adding a comment to clarify this mapping.
model.username(), | |
model.nickname(), // Use nickname instead of username for clarity |
Copilot uses AI. Check for mistakes.
services/auth/application/src/main/java/nettee/auth/service/AuthCommandService.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
우선 지난 번에 별도 채널로 전달드린 내용을 작성해 두겠습니다...!
지난 리뷰
- 다음부터 Flyway 스크립트 수정은 반드시 Flyway 브랜치를 이용합니다.
: 여러 브랜치에서 '서로 겹치는 버전 번호로' 병합될 수 있기 때문입니다. (이때 파일 이름은 구분되므로 깃은 이 버전 충돌을 인지하지 못하며, 병합 이후 그 문제가 발견됩니다.) - 외래키는 실제로 부여하지 않습니다.
- 계정당 여러 프로필이 추가될 수 있으므로(추후), 지금 단계에서도 UNIQUE 제약조건은 제외해 두기로 논의하였습니다.
- 프로필 테이블이 수정되었다면, 아직 배포 전이므로 새 버전 번호를 부여하기보다 기존 파일을 수정하는 게 좋아 보입니다. (특히 테이블을 삭제하는 건 파일 삭제보다는 DROP 테이블로 하는 게 좋습니다.)
- CREATE가 배포되기 전: 기존 파일 수정
- CREATE까지 배포되었을 때: DROP 테이블을 반드시 명시해야 함. (기존 파일 삭제 시 FLYWAY 마이그레이션 오류 → 배포 환경에서 실수가 발생하면 심각)
- 프로필 더미 데이터를 다시 추가합니다.
- '디자인' 기준으로 사용자가 입력한 블로그 주소가 데이터로는 'username'입니다.
- 프로필 생성 프로세스 (최근 논의 결과)
- 사용자 계정 생성 시 프로필 생성 (기본값 할당)
- '화면 디자인' 기준 사용자 프로필 생성은 '백엔드' 기준 프로필 수정
이유는 사용자 경험 및 관리 편의성입니다.
Issues
Description
profile
서비스 모듈 구현프로필 관련 DB 테이블 생성
회원가입 시, 사용되는 프로필 생성 API 구현
Review Points
이 때 사용자가 입력한 이메일을 기반으로 임시 닉네임을 설정하려 했지만, auth API를 호출하는 구조로 이어져 임시 닉네임은
user_
prefix와 랜덤문자열(ex.user_abc123
)을 조합한 형태로 설정하도록 구현했습니다.How Has This Been Tested?