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

[#31] Telegram Bot 기본 연동 및 회원가입 기능 구현 #32

Merged
merged 5 commits into from
Feb 18, 2025

Conversation

austinhong22
Copy link
Collaborator

Telegram Bot 기본 연동 및 회원가입 기능 구현

  • User domain 패스워드 삭제
  • telegram bot 라이브러리 연동
  • 순환참조를 방지하기 위해 이벤트 기반 메세지를 통해 telegrambot과 userservice 구현
  • 사용자가 봇과 /start 대화를 시작하면 이메일,유저네임을 입력받고, Telegram Chat ID와 함께 User DB에 회원가입 정보를 저장
  • 사용자는 OTP를 사용하여 로그인

@austinhong22 austinhong22 self-assigned this Feb 17, 2025
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
2 Security Hotspots

See analysis details on SonarQube Cloud


// 사용자의 이메일을 받아 OTP를 생성 후 텔레그램으로 전송
@PostMapping("/request-otp")
public String requestOtp(@RequestBody Map<String, String> request) {

Choose a reason for hiding this comment

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

리턴 타입을 전부 동일하게 맞추는 것이 좋을 것 같습니다. 그래서 이 메소드도 클래스로 감싸서 결과를 내보내면 좋을 것 같네요.

private String password;

private Long telegramChatId;
private String otpHash;

Choose a reason for hiding this comment

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

이 필드는 일회용일테니, 필요하다면, 캐쉬같은 곳에 저장하면 좋을 것 같네요.

}

@Override
public void onUpdateReceived(Update update) {

Choose a reason for hiding this comment

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

멀티 인스턴스 환경에서 어떻게 동작하는지 확인해보시면 좋을 것 같아요.

private final UserService userService;
private final TelegramBotProperties telegramBotProperties;

private Map<Long, RegistrationData> registrationDataMap = new HashMap<>();

Choose a reason for hiding this comment

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

다중 인스턴스 환경에 맞춰서 이 내용은 DB에 저장해야하지 않을까요? 혹은 캐쉬에 저장하거나

Copy link

@f-lab-lyan f-lab-lyan left a comment

Choose a reason for hiding this comment

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

멀티인스턴스에 대한 고민이 필요해보이지만, 로직은 잘 작성하신 것 같습니다. 👍

@austinhong22 austinhong22 merged commit dafd9f9 into develop Feb 18, 2025
1 of 2 checks passed
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.

2 participants