Skip to content

refactor(audit-log): AuditLogRepository를 신규 audit-log 모듈로 분리 (P0-1 단계 2)#107

Merged
chanwoo7 merged 1 commit into
developfrom
refactor/auth-audit-log-repository
May 27, 2026
Merged

refactor(audit-log): AuditLogRepository를 신규 audit-log 모듈로 분리 (P0-1 단계 2)#107
chanwoo7 merged 1 commit into
developfrom
refactor/auth-audit-log-repository

Conversation

@chanwoo7
Copy link
Copy Markdown
Member

Summary

  • AuthRepository · SellerRepository 양쪽에 중복 구현되어 있던 createAuditLog단일 책임의 audit-log 모듈로 통합.
  • 신규 Repository 는 P1-1 방침에 따라 interface + Symbol DI Token 패턴.
  • 두 도메인 모듈이 AuditLogModule 을 import 하여 공유 (cross-feature import 위반 없이 깔끔하게).

Scope

  • 신규
    • 모듈: `src/features/audit-log/`
    • `IAuditLogRepository` + `AUDIT_LOG_REPOSITORY` Symbol 토큰
    • `AuditLogRepository` 구체 구현
    • `audit-log.repository.spec.ts` (실DB 통합 테스트)
  • 제거
    • `AuthRepository.createAuditLog` (Auth feature 의 1곳 사용)
    • `SellerRepository.createAuditLog` (Seller 6개 서비스 36개 사용)
  • 변경
    • AuthService: `this.repo.createAuditLog` → `this.auditLogs.createAuditLog`
    • 6개 Seller Service: `this.repo.createAuditLog` → `this.auditLogs.createAuditLog`
    • SellerBaseService: `protected readonly auditLogs: IAuditLogRepository` 추가, 7개 subclass 생성자 전달
    • AuthModule + SellerModule: `AuditLogModule` import
    • 영향 받은 spec 모두 `AUDIT_LOG_REPOSITORY` provider 등록 동반 갱신

Non-goals

  • AuthService 자체 분해(Token / Session / SellerCredential 분리) 는 P0-1 후속 단계
  • AuthRepository 의 나머지(Account / SellerCredential) 분리는 P0-1 단계 3

Plan deviation 안내

원 플랜은 audit-log 를 `auth/repositories/` 에 두는 안이었습니다. 실제 코드를 보니 Seller 서비스에서 36곳 사용 중이라 auth 내부로 두면 `seller → auth` 도메인 의존이 생겨 cross-cutting 한 audit 의 성격과 맞지 않아 별도 audit-log 모듈로 분리했습니다. 두 도메인이 동일한 import 라인을 통해 공유합니다.

Impact

  • FE: 없음 (응답·엔드포인트·에러 형태 동일)
  • DB: 변경 없음 (`audit_log` 테이블 스키마/쿼리 그대로)
  • Coverage: 1168 tests pass, 전 임계 통과

Test plan

  • yarn validate (lint + tsc + dto:check + test:cov) 로컬 통과
  • audit-log.repository.spec.ts 신규 통합 테스트 (실DB)
  • 기존 auth/seller spec 들이 새 provider 등록 후 회귀 없음
  • CI 통과 확인

P0-1 단계 2. AuthRepository와 SellerRepository에 중복 구현되어 있던
createAuditLog 를 단일 책임의 audit-log 모듈로 통합.

- 신규 모듈: src/features/audit-log/
  - IAuditLogRepository + AUDIT_LOG_REPOSITORY Symbol 토큰
  - AuditLogRepository 구체 구현
  - 통합 테스트 (실DB) + 기본 분기 커버
- 제거: AuthRepository.createAuditLog (5개 args 포함 38줄), SellerRepository.createAuditLog (28줄)
- 소비자 전환:
  - AuthService 1개 호출부
  - Seller 6개 서비스 36개 호출부 (SellerBaseService 에 protected auditLogs 추가, 7개 subclass 생성자 전달)
- 모듈 배선: AuthModule + SellerModule 에 AuditLogModule import
- 영향 spec 모두 AUDIT_LOG_REPOSITORY provider 등록으로 동반 갱신
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 26, 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: 85e9a4d4-fcc8-48dd-87ae-088039238fb2

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-audit-log-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 26, 2026

Codecov Report

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

Files with missing lines Patch % Lines
...res/audit-log/repositories/audit-log.repository.ts 90.90% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@github-actions
Copy link
Copy Markdown

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements 97.11% 3321/3420
🟢 Branches 92.99% 1128/1213
🟢 Functions 93.5% 633/677
🟢 Lines 97.41% 3046/3127

Test suite run success

1168 tests passing in 132 suites.

Report generated by 🧪jest coverage report action from b2e22fd

@chanwoo7 chanwoo7 merged commit 606d172 into develop May 27, 2026
10 checks passed
@chanwoo7 chanwoo7 deleted the refactor/auth-audit-log-repository branch May 27, 2026 17:14
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