Skip to content

refactor(auth): AccountRepository / SellerCredentialRepository 분리 + AuthRepository 제거 (P0-1 단계 3)#108

Merged
chanwoo7 merged 1 commit into
developfrom
refactor/auth-account-seller-credential-repository
May 27, 2026
Merged

refactor(auth): AccountRepository / SellerCredentialRepository 분리 + AuthRepository 제거 (P0-1 단계 3)#108
chanwoo7 merged 1 commit into
developfrom
refactor/auth-account-seller-credential-repository

Conversation

@chanwoo7
Copy link
Copy Markdown
Member

Summary

  • AuthRepository 의 잔여 책임을 2 개 도메인 Repository 로 분리하고 빈 AuthRepository 자체를 제거.
  • 단계 1·2 (RefreshSession / AuditLog) 와 합쳐, God-class 530 줄을 4 개의 책임별 Repository 로 모두 해체.
  • 모든 신규 Repository 는 interface + Symbol DI Token 패턴 (P1-1 방침 일관).

Scope

  • 신규
    • AccountRepository (interface + impl + spec) — Account / AccountIdentity / UserProfile 의 read/write
      • findIdentityByProviderSubject, findAccountByEmail, upsertUserByOidcIdentity,
        findAccountForJwt, findAccountForMe
      • 인터페이스 반환 타입은 `Prisma.{Model}GetPayload<...>` 로 명시
    • SellerCredentialRepository (interface + impl + spec) — username / password_hash / last_login_at write
      • findSellerCredentialByUsername, findSellerCredentialByAccountId,
        updateSellerLastLogin, updateSellerPasswordHash
  • 제거
    • AuthRepository (530줄) + 해당 spec
  • 변경
    • AuthService: `accounts` / `sellerCredentials` 2 개 신규 의존, `this.repo.*` 호출 8 개 전환
    • JwtBearerStrategy: `accounts` 의존으로 전환
    • AuthModule: 신규 2 개 Repository 를 DI Token 패턴으로 등록
    • 영향 받은 모든 spec 동반 갱신 (auth.service / auth.seller / jwt-bearer / app.e2e)

P0-1 진행 상황

  • ✅ 단계 1: RefreshSessionRepository
  • ✅ 단계 2: AuditLogRepository (신규 audit-log 모듈)
  • ✅ 단계 3: AccountRepository / SellerCredentialRepository (본 PR)
  • ⏳ 단계 4: TokenService 추출
  • ⏳ 단계 5: OidcLoginService 추출
  • ⏳ 단계 6: SellerCredentialService + logout 통합
  • ⏳ 단계 7: AuthService 잔여 정리

Impact

  • FE: 없음 (REST 엔드포인트·응답·에러 형태 동일)
  • DB: 변경 없음
  • Coverage: 1168 tests pass, 전 임계 통과

Test plan

  • yarn validate (lint + tsc + dto:check + test:cov) 로컬 통과
  • account.repository.spec.ts / seller-credential.repository.spec.ts 신규 통합 테스트
  • auth.service / auth.seller.service / jwt-bearer.strategy / app.e2e 모두 회귀 없음
  • CI 통과 확인

…uthRepository 제거

P0-1 단계 3. AuthRepository 의 잔여 책임을 2 개의 도메인 Repository 로 분리하고,
빈 AuthRepository 를 삭제하여 God-class 해체의 큰 줄기를 마무리.

- 신규: AccountRepository (interface + impl + spec)
  - Account / AccountIdentity / UserProfile 의 read/write
  - findIdentityByProviderSubject, findAccountByEmail, upsertUserByOidcIdentity,
    findAccountForJwt, findAccountForMe
  - Prisma.{Model}GetPayload<...> 로 인터페이스 반환 타입 정의
- 신규: SellerCredentialRepository (interface + impl + spec)
  - findSellerCredentialByUsername, findSellerCredentialByAccountId,
    updateSellerLastLogin, updateSellerPasswordHash
- 제거: AuthRepository (530줄 → 0) + 그 spec
- 소비자 전환:
  - AuthService: accounts / sellerCredentials 2 개 신규 의존, this.repo 호출 8 개 전환
  - JwtBearerStrategy: accounts 의존으로 전환
  - test/app.e2e-spec.ts: AuthRepository override → ACCOUNT_REPOSITORY override
- AuthModule: 신규 2 개 Repository 를 DI Token 패턴으로 등록
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 27, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 701e2ea7-79b6-42bc-ada2-b9d7561165cc

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/auth-account-seller-credential-repository

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.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 27, 2026

Codecov Report

❌ Patch coverage is 96.42857% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...rc/features/auth/strategies/jwt-bearer.strategy.ts 66.66% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@github-actions
Copy link
Copy Markdown

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements 97.11% 3331/3430
🟢 Branches 92.99% 1128/1213
🟢 Functions 93.51% 634/678
🟢 Lines 97.42% 3054/3135

Test suite run success

1168 tests passing in 133 suites.

Report generated by 🧪jest coverage report action from 6999053

@chanwoo7 chanwoo7 merged commit 93693da into develop May 27, 2026
10 checks passed
@chanwoo7 chanwoo7 deleted the refactor/auth-account-seller-credential-repository branch May 27, 2026 17:36
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