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

refactor: 디스코드 연동 로직에 도메인 서비스 적용 #485

Merged

Conversation

Sangwook02
Copy link
Member

@Sangwook02 Sangwook02 commented Jul 19, 2024

🌱 관련 이슈

📌 작업 내용 및 특이사항

  • 아래의 3가지에 대한 검증을 OnboardingDiscordService에서 DiscordValidator로 옮겼습니다.
    • 인증코드 일치여부
    • 유저네임 중복여부
    • 닉네임 중복여부

📝 참고사항

📚 기타

  • 수정하는 김에 로그도 한 줄 추가했습니다.

Summary by CodeRabbit

  • 신규 기능

    • Discord 사용자 검증을 위한 DiscordValidator 클래스 추가, 중복 사용자 이름 및 별명 검증 기능 포함.
    • Discord 코드 검증의 효율성을 높이기 위한 통합 검증 로직 개선.
  • 버그 수정

    • Discord 계정 링크 시 발생할 수 있는 오류 로깅 기능 추가.
  • 문서화

    • Discord 관련 상수를 관리하기 위한 DiscordConstant 클래스 추가.

@Sangwook02 Sangwook02 self-assigned this Jul 19, 2024
@Sangwook02 Sangwook02 requested a review from a team as a code owner July 19, 2024 12:47
Copy link

Job Summary for Gradle

Check Style and Test to Develop :: build-test
Gradle Root Project Requested Tasks Gradle Version Build Outcome Build Scan®
gdsc check 8.5 Build Scan published

Copy link

coderabbitai bot commented Jul 19, 2024

Warning

Rate limit exceeded

@Sangwook02 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 19 minutes and 57 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Commits

Files that changed from the base of the PR and between 3e68ffa and e3becd2.

Walkthrough

디스코드 연동 서비스에서 검증 로직을 개선하기 위해 DiscordValidator를 도입하고, 관련 메서드를 통합하여 코드의 가독성과 유지보수성을 향상시켰습니다. 새로운 검증 로직은 중복 사용자명과 별명 검사를 단일 호출로 처리하며, 로깅 기능도 추가되어 성공적인 계정 연동 시 멤버 ID를 기록합니다.

Changes

파일 경로 변경 요약
src/main/java/com/gdschongik/gdsc/domain/discord/application/OnboardingDiscordService.java DiscordValidator가 추가되어 검증 로직이 통합되었으며, 메서드 구조가 개선되었습니다. 로깅 기능이 추가되었습니다.
src/main/java/com/gdschongik/gdsc/domain/discord/domain/DiscordValidator.java 새로 추가된 DiscordValidator 클래스가 Discord 관련 검증 로직을 처리하며, validateVerifyDiscordCode 메서드가 구현되었습니다.
src/test/java/com/gdschongik/gdsc/domain/discord/DiscordValidatorTest.java DiscordValidator의 단위 테스트가 추가되어 검증 로직의 예외 상황을 테스트합니다.
src/test/java/com/gdschongik/gdsc/global/common/constant/DiscordConstant.java Discord 관련 상수를 관리하는 DiscordConstant 클래스가 새로 추가되었습니다.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant OnboardingDiscordService
    participant DiscordValidator
    participant Database

    User->>OnboardingDiscordService: DiscordLinkRequest
    OnboardingDiscordService->>DiscordValidator: validateVerifyDiscordCode
    DiscordValidator->>Database: Check code and duplicates
    Database-->>DiscordValidator: Return validation results
    DiscordValidator-->>OnboardingDiscordService: Validation result
    OnboardingDiscordService-->>User: Discord account linked successfully
Loading

Assessment against linked issues

Objective Addressed Explanation
디스코드 연동 로직에 도메인 서비스 적용 (#483)

🐰 변화를 축하하며, 토끼가 노래해요!

디스코드가 연결돼, 모두 함께 해요,
새로운 검증이, 우리를 지켜줘요.
로깅도 추가돼, 멤버 ID를 기록해,
코드가 깔끔해져, 기분이 좋아요!
🐇✨


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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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

@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 68f632e and 411e3cb.

Files selected for processing (4)
  • src/main/java/com/gdschongik/gdsc/domain/discord/application/OnboardingDiscordService.java (4 hunks)
  • src/main/java/com/gdschongik/gdsc/domain/discord/domain/DiscordValidator.java (1 hunks)
  • src/test/java/com/gdschongik/gdsc/domain/discord/DiscordValidatorTest.java (1 hunks)
  • src/test/java/com/gdschongik/gdsc/global/common/constant/DiscordConstant.java (1 hunks)
Files skipped from review due to trivial changes (1)
  • src/test/java/com/gdschongik/gdsc/global/common/constant/DiscordConstant.java
Additional comments not posted (10)
src/main/java/com/gdschongik/gdsc/domain/discord/domain/DiscordValidator.java (1)

11-27: 검증 로직이 적절합니다.

validateVerifyDiscordCode 메서드는 디스코드 인증 코드와 중복 사용자명 및 별명을 검증합니다. 예외 처리가 적절하게 이루어지고 있습니다.

src/test/java/com/gdschongik/gdsc/domain/discord/DiscordValidatorTest.java (3)

20-31: 테스트 케이스가 적절합니다.

인증코드가_일치하지_않는다면_실패한다 테스트는 인증 코드가 일치하지 않을 때 예외가 발생하는지 확인합니다.


33-44: 테스트 케이스가 적절합니다.

이미_존재하는_디스코드_유저네임이라면_실패한다 테스트는 중복된 디스코드 사용자명이 있을 때 예외가 발생하는지 확인합니다.


46-57: 테스트 케이스가 적절합니다.

이미_존재하는_닉네임이라면_실패한다 테스트는 중복된 닉네임이 있을 때 예외가 발생하는지 확인합니다.

src/main/java/com/gdschongik/gdsc/domain/discord/application/OnboardingDiscordService.java (6)

7-7: 새로운 의존성 추가가 적절합니다.

DiscordValidator가 올바르게 추가되었습니다.


22-22: 로깅 기능 추가가 적절합니다.

@Slf4j 애노테이션을 사용하여 로깅 기능이 추가되었습니다.


37-37: 새로운 의존성 주입이 적절합니다.

DiscordValidator가 생성자 주입 방식으로 올바르게 주입되었습니다.


65-66: 중복 사용자명 및 별명 검사가 적절합니다.

중복된 디스코드 사용자명과 별명을 검사하는 로직이 추가되었습니다.


68-69: 검증 로직이 적절합니다.

discordValidator.validateVerifyDiscordCode 메서드를 호출하여 검증 로직을 처리합니다.


78-78: 로깅이 적절합니다.

성공적인 디스코드 연동 시 멤버 ID를 로깅합니다.

Copy link

Job Summary for Gradle

Check Style and Test to Develop :: build-test
Gradle Root Project Requested Tasks Gradle Version Build Outcome Build Scan®
gdsc check 8.5 Build Scan published

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 411e3cb and 3e68ffa.

Files selected for processing (1)
  • src/main/java/com/gdschongik/gdsc/domain/discord/domain/DiscordValidator.java (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • src/main/java/com/gdschongik/gdsc/domain/discord/domain/DiscordValidator.java

Copy link
Member

@uwoobeat uwoobeat left a comment

Choose a reason for hiding this comment

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

lgtm

public class DiscordValidator {

public void validateVerifyDiscordCode(
Integer code,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Integer code,
Integer requestedCode,

Copy link

Job Summary for Gradle

Check Style and Test to Develop :: build-test
Gradle Root Project Requested Tasks Gradle Version Build Outcome Build Scan®
gdsc check 8.5 Build Scan published

Copy link
Member

@AlmondBreez3 AlmondBreez3 left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Contributor

@seulgi99 seulgi99 left a comment

Choose a reason for hiding this comment

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

LGTM

@Sangwook02 Sangwook02 merged commit f7b9efa into develop Jul 19, 2024
1 check passed
@Sangwook02 Sangwook02 deleted the refactor/483-apply-domain-service-on-verify-discord branch July 19, 2024 13:15
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.

♻️ 디스코드 연동 로직에 도메인 서비스 적용
4 participants