Skip to content
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

✨ 인증 코드 도메인 정의 #7

Merged
merged 1 commit into from
Sep 9, 2024
Merged

✨ 인증 코드 도메인 정의 #7

merged 1 commit into from
Sep 9, 2024

Conversation

waterfogSW
Copy link
Member

@waterfogSW waterfogSW commented Sep 9, 2024

인증코드는 유저랑 라이프사이클이 달라서 별도 바운디드 컨텍스트로 분리했습니다.

Summary by CodeRabbit

  • 새로운 기능

    • 인증 코드 생성을 위한 AuthCode 클래스 추가.
    • 인증 코드 유효성 검사를 위한 메서드 verify() 추가.
    • 인증 코드 관련 예외 처리를 위한 AuthException 클래스 추가.
    • 인증 코드 관리 인터페이스 AuthCodeRepository 추가.
    • 인증 코드 ID를 위한 AuthCodeId 클래스 추가.
  • 버그 수정

    • 인증 코드 생성 및 검증 로직에 대한 단위 테스트 추가로 신뢰성 향상.

@waterfogSW waterfogSW self-assigned this Sep 9, 2024
@waterfogSW waterfogSW requested a review from dojinyou as a code owner September 9, 2024 15:07
Copy link

coderabbitai bot commented Sep 9, 2024

Walkthrough

이 변경 사항은 인증 코드 관리를 위한 새로운 도메인 모델을 도입하는 것입니다. AuthCode 데이터 클래스, 관련 예외 처리 클래스인 AuthException, 인증 코드 식별자를 나타내는 AuthCodeId 데이터 클래스, 그리고 인증 코드 작업을 위한 AuthCodeRepository 인터페이스가 새로 추가되었습니다. 또한, AuthCode 클래스의 기능을 검증하기 위한 단위 테스트가 포함되어 있습니다.

Changes

파일 경로 변경 요약
domain/src/main/kotlin/com/threedays/domain/auth/entity/AuthCode.kt AuthCode 데이터 클래스와 Code 내장 클래스 추가, 생성 및 검증 메소드 구현.
domain/src/main/kotlin/com/threedays/domain/auth/exception/AuthException.kt AuthException 봉인 클래스 및 관련 예외 클래스(AuthCodeExpiredException, InvalidAuthCodeException) 추가.
domain/src/main/kotlin/com/threedays/domain/auth/repository/AuthCodeRepository.kt AuthCodeRepository 인터페이스 추가, 인증 코드 관련 데이터 접근 작업 정의.
domain/src/main/kotlin/com/threedays/domain/auth/vo/AuthCodeId.kt AuthCodeId 데이터 클래스 추가, UUID 기반 인증 코드 식별자 정의.
domain/src/test/kotlin/com/threedays/domain/auth/entity/AuthCodeTest.kt AuthCode 클래스에 대한 단위 테스트 추가, 생성 및 검증 기능 테스트.

Possibly related PRs

  • ✨ 유저 영속성 레이어 구현 #4: 이 PR은 인증 도메인의 일부로 AuthCode 클래스와 관련된 사용자 지속성 계층 구현을 포함합니다.
  • 👷 Sonar Cloud 추가 #6: 이 PR은 CI/CD 개선 및 코드 품질 분석에 초점을 맞추고 있지만, 인증 코드 관리와는 직접적인 관련이 없습니다.

🐰 새로운 코드가 생겼어요,
인증의 길을 밝혀주네.
예외도 잘 처리하고,
테스트로 안전하게,
이제 모두가 안심해!
코드는 빛나고,
Rabbit은 기뻐해요! 🌟

Tip

New features

Walkthrough comment now includes:

  • Possibly related PRs: A list of potentially related PRs to help you recall past context.
  • Suggested labels: CodeRabbit can now suggest labels by learning from your past PRs. You can also provide custom labeling instructions in the UI or configuration file.

Notes:

  • Please share any feedback in the discussion post on our Discord.
  • Possibly related PRs, automatic label suggestions based on past PRs, learnings, and possibly related issues require data opt-in (enabled by default).

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Member Author

@waterfogSW waterfogSW Sep 9, 2024

Choose a reason for hiding this comment

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

p3) 이거 서브모듈 왜 계속 changed로 남는지 아시나요?

Copy link
Collaborator

Choose a reason for hiding this comment

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

저도 잘 모르겠네용...허허 알면 알려주세요

Copy link

sonarqubecloud bot commented Sep 9, 2024

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between d9c25f4 and 5166797.

Files selected for processing (6)
  • domain/src/main/kotlin/com/threedays/domain/auth/entity/AuthCode.kt (1 hunks)
  • domain/src/main/kotlin/com/threedays/domain/auth/exception/AuthException.kt (1 hunks)
  • domain/src/main/kotlin/com/threedays/domain/auth/repository/AuthCodeRepository.kt (1 hunks)
  • domain/src/main/kotlin/com/threedays/domain/auth/vo/AuthCodeId.kt (1 hunks)
  • domain/src/test/kotlin/com/threedays/domain/auth/entity/AuthCodeTest.kt (1 hunks)
  • openapi (1 hunks)
Files skipped from review due to trivial changes (2)
  • domain/src/main/kotlin/com/threedays/domain/auth/repository/AuthCodeRepository.kt
  • openapi
Additional comments not posted (10)
domain/src/main/kotlin/com/threedays/domain/auth/vo/AuthCodeId.kt (1)

6-6: UUIDTypeId 상속을 통한 타입 안전성 강화

AuthCodeId 클래스는 UUIDTypeId를 상속받아 UUID를 안전하게 관리합니다. 이 구조는 타입 안전성을 강화하며, UUID의 유효성을 보장하는 데 도움이 됩니다.

domain/src/main/kotlin/com/threedays/domain/auth/exception/AuthException.kt (1)

5-18: 예외 처리 클래스의 구조화

AuthException 클래스는 봉인된 클래스를 사용하여 인증 관련 예외의 종류를 제한합니다. 각 예외는 고유한 메시지와 코드 번호를 가지고 있어, 오류 처리와 디버깅에 유용합니다.

domain/src/main/kotlin/com/threedays/domain/auth/entity/AuthCode.kt (1)

9-52: 인증 코드 관리 및 검증 로직 구현

AuthCode 클래스는 인증 코드의 생성, 관리 및 검증을 담당합니다. 클래스는 AggregateRoot를 상속받아 도메인 주도 설계의 원칙을 잘 따르고 있습니다. 인증 코드의 유효성 검사는 명확하게 정의되어 있으며, 유효하지 않은 경우 또는 만료된 경우에 대한 예외 처리가 적절히 구현되어 있습니다.

domain/src/test/kotlin/com/threedays/domain/auth/entity/AuthCodeTest.kt (7)

1-11: 구조 및 임포트 승인

테스트 클래스의 구조와 임포트가 적절하게 관리되고 있습니다. Kotest를 사용한 테스트 작성 방식이 명확하게 구현되어 있습니다.


15-28: 새로운 인증 코드 생성 테스트 승인

인증 코드 생성에 대한 테스트가 잘 구현되어 있습니다. 코드의 길이, 숫자 여부, 만료 시간 일치 등 필요한 모든 속성을 정확하게 검증하고 있습니다.


31-43: 유효한 인증 코드 검증 테스트 승인

유효한 인증 코드에 대한 검증이 예외 없이 정상적으로 수행되는 것을 확인하는 테스트가 잘 구현되어 있습니다.


46-57: 잘못된 인증 코드 처리 테스트 승인

잘못된 인증 코드를 사용할 때 InvalidAuthCodeException이 발생하는 것을 확인하는 테스트가 적절하게 구현되어 있습니다.


60-70: 만료된 인증 코드 처리 테스트 승인

만료된 인증 코드를 사용할 때 AuthCodeExpiredException이 발생하는 것을 확인하는 테스트가 적절하게 구현되어 있습니다.


74-104: 인증 코드 값 객체 테스트 승인

인증 코드의 값 객체에 대한 테스트가 잘 구현되어 있습니다. 유효한 코드 생성, 길이 불일치 및 숫자가 아닌 문자 포함에 대한 예외 처리가 포함되어 있어 객체의 무결성을 보장합니다.


106-115: 코드 생성 테스트 승인

코드 생성 기능에 대한 테스트가 잘 구현되어 있습니다. 생성된 코드가 6자리 숫자로만 구성되어 있는지를 정확하게 검증하고 있습니다.

Copy link
Collaborator

@dojinyou dojinyou left a comment

Choose a reason for hiding this comment

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

auth code 생성되고 이후에 삭제 되진 않아도 되나요? ttl이 없어서 db 크론 돌려야하나

@waterfogSW
Copy link
Member Author

Redis ttl로 날리려구요

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants