Skip to content

feature: 사용자 로그인 계정 모델과 저장소 추가 - #8

Closed
ddingmin wants to merge 6 commits into
mainfrom
feature/set-jpa
Closed

feature: 사용자 로그인 계정 모델과 저장소 추가#8
ddingmin wants to merge 6 commits into
mainfrom
feature/set-jpa

Conversation

@ddingmin

@ddingmin ddingmin commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

📌 작업 개요

사용자와 로그인 계정 도메인·JPA Entity·Repository를 추가하고, 로컬 PostgreSQL 개발 환경을 구성했습니다.

🔖 PR 유형

  • feat (기능 추가)
  • fix (버그 수정)
  • refactor (리팩토링)
  • docs (문서)
  • chore (설정, 빌드 등)

📝 변경 사항

  • User, LoginAccount, LoginProvider 도메인 모델과 Entity 변환을 추가했습니다.
  • UserRepository, LoginAccountRepository와 각각의 CRUD 통합 테스트를 추가했습니다.
  • fromDomain() 변환 시 기존 Entity ID를 보존하도록 수정했습니다.
  • Docker Compose PostgreSQL과 local 프로필 접속 설정을 추가했습니다.
  • 닉네임 길이를 1~12자로 제한하고 로그인 provider에 APPLE을 추가했습니다.

🔗 관련 이슈

  • 없음

✅ 테스트 / 확인 방법

  • ./gradlew check 통과
  • PostgreSQL 17 임시 DB에서 UserRepositoryTest, LoginAccountRepositoryTest 통과
  • docker compose up -d postgres 실행 후 local 프로필 애플리케이션 시작 확인

⚠️ 특이사항

  • DB 스키마 변경 있음 (변경 시 팀에 공유)
  • 환경 변수 / 인프라 설정 변경 있음

💬 리뷰어에게

  • 도메인 객체와 JPA Entity를 분리하고 Service가 Spring Data Repository를 직접 사용하는 구조를 확인해주세요.
  • LoginAccount는 생성 이후 변경하지 않으며, 생성 시 provider_id를 DB 컬럼 길이와 같은 최대 255자로 검증합니다.
  • Entity 간 JPA 연관관계는 사용하지 않고 LoginAccountEntityuserId만 저장합니다.
  • Flyway 기반 외래 키와 운영 마이그레이션은 후속 작업에서 적용할 예정입니다.

🧹 셀프 체크리스트

  • 로컬에서 빌드 및 테스트 통과
  • 커밋 메시지가 Conventional Commits 규칙을 따름
  • 불필요한 코드/로그/주석 제거

@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown

🧪 테스트 결과

성공 실패 스킵
16 0 0

상세 테스트 결과 보기

@ddingmin
ddingmin marked this pull request as ready for review July 21, 2026 00:36
@ddingmin
ddingmin requested a review from swonny as a code owner July 21, 2026 00:36

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cf4f05d242

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

import jakarta.persistence.Table

@Entity
@Table(name = "login_account")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 운영용 스키마 마이그레이션을 추가하세요

application-dev.ymlapplication-prod.ymlddl-auto: validate를 사용하지만, 대상 커밋에는 이 테이블들을 만드는 Flyway/Liquibase/SQL 마이그레이션이 없습니다. 새 환경 또는 아직 login_account 테이블이 없는 배포 DB에서 애플리케이션을 시작하면 Hibernate의 스키마 검증이 실패하여 기동하지 못합니다. UserEntity 테이블을 포함해 이 변경으로 추가된 스키마를 생성하는 마이그레이션을 함께 추가해야 합니다.

Useful? React with 👍 / 👎.

Comment on lines +23 to +24
@field:Column(name = "provider_id", nullable = false, length = 255)
var providerId: String,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge providerId 길이를 영속 컬럼과 일치시키세요

LoginAccountproviderId가 256자 이상이어도 생성·변경을 허용하며 추가된 도메인 테스트도 이를 유효한 값으로 규정합니다. 그러나 이 컬럼은 VARCHAR(255)로 생성되므로 그런 계정을 저장하는 실제 로그인 흐름에서는 PostgreSQL이 길이 초과 오류를 내고 요청이 실패합니다. 도메인에서 255자로 검증하거나 컬럼 길이를 허용 범위에 맞게 늘려야 합니다.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8d1b3c503e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 077a2c37f1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

companion object {
fun fromDomain(user: User): UserEntity =
UserEntity(nickname = user.nickname)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 기존 사용자 ID를 매핑에 보존하세요

이미 저장된 UsertoDomain()으로 읽어 닉네임을 변경한 뒤 UserEntity.fromDomain()으로 다시 저장하는 흐름에서는 user.id가 이 Entity에 전달되지 않아 ID가 항상 null입니다. 따라서 JpaRepository.save()가 기존 행 갱신 대신 새 행을 삽입하여 사용자가 중복 생성됩니다. 현재 테스트도 이 문제를 피해 조회한 Entity를 직접 수정하고 있으므로, 도메인 변환을 사용하는 Service에서는 막아주지 못합니다.

Useful? React with 👍 / 👎.


companion object {
fun fromDomain(loginAccount: LoginAccount): LoginAccountEntity =
LoginAccountEntity(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 기존 로그인 계정 ID를 매핑에 보존하세요

저장된 LoginAccount를 도메인으로 변환해 changeProvider()를 호출한 뒤 LoginAccountEntity.fromDomain()으로 저장하면 loginAccount.id가 버려져 새 Entity가 만들어집니다. 이 경우 제공자 변경이 기존 로그인 계정을 갱신하지 않고 새 행을 삽입하므로, 동일 사용자에게 이전 제공자 계정과 변경 후 계정이 함께 남습니다. 테스트가 Entity의 필드를 직접 수정하는 방식이라 이 변환 경로의 중복 저장을 검증하지 못합니다.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 727cd5df40

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +15 to +17

private fun validateNickname(nickname: String) {
require(nickname.length in MIN_NICKNAME_LENGTH..MAX_NICKNAME_LENGTH) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 공백만 있는 닉네임을 거부하세요

" "처럼 공백으로만 구성된 값은 길이가 1 이상이므로 현재 검증을 통과하고, nicknamenullable = falseUserEntity에도 그대로 저장됩니다. 사용자 입력에서 공백 닉네임을 허용하면 다른 사용자가 식별할 수 없는 계정이 생성되므로, 길이를 검사하기 전에 공백 여부를 함께 검증해야 합니다.

Useful? React with 👍 / 👎.

@ddingmin ddingmin closed this Jul 27, 2026
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