Skip to content

feat: Send message when a user registers or creates a group#386

Merged
rladmstn merged 2 commits intodevelopfrom
feat/BE-30
Jun 6, 2025
Merged

feat: Send message when a user registers or creates a group#386
rladmstn merged 2 commits intodevelopfrom
feat/BE-30

Conversation

@hwangjokim
Copy link
Contributor

📌 Related Issue

close be-30

🚀 Description

  • 회원가입, 그룹 생성시 디코에 알림 쏩니다
  • 30분정도 짬내서 짠거라.. AOP로 구현은 다음에 ㅜㅠ

@hwangjokim hwangjokim self-assigned this May 26, 2025
@linear
Copy link

linear bot commented May 26, 2025

@hwangjokim hwangjokim added the new-feature 기능 추가 label May 26, 2025
@channeltalk
Copy link

channeltalk bot commented May 26, 2025

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds Discord notifications for user registration and study group creation by introducing a new DiscordWebhookService and invoking it in relevant service methods.

  • Inject and call DiscordWebhookService in UserService, OAuth2Service, and StudyGroupService
  • Implement DiscordWebhookService to post messages to a configured webhook URL

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/main/java/com/gamzabat/algohub/feature/user/service/UserService.java Added webhook call after user registration
src/main/java/com/gamzabat/algohub/auth/service/OAuth2Service.java Added webhook call after GitHub-based registration
src/main/java/com/gamzabat/algohub/feature/group/studygroup/service/StudyGroupService.java Added webhook call after study group creation
src/main/java/com/gamzabat/algohub/common/logging/DiscordWebhookService.java New service to send Discord webhook notifications
Comments suppressed due to low confidence (3)

src/main/java/com/gamzabat/algohub/feature/user/service/UserService.java:100

  • [nitpick] The literal "SignUp" could be inconsistent or typo-prone; consider defining a constant or enum for registration types to ensure consistency.
webhookService.sendRegisterMessage(user.getNickname(), "SignUp", user.getId());

src/main/java/com/gamzabat/algohub/auth/service/OAuth2Service.java:85

  • [nitpick] The literal "Github" should align with proper branding ("GitHub") and be centralized to avoid typos; consider using a shared constant.
webhookService.sendRegisterMessage(newUser.getNickname(), "Github", newUser.getId());

src/main/java/com/gamzabat/algohub/common/logging/DiscordWebhookService.java:23

  • The new service methods lack unit or integration tests for both success and failure scenarios; consider adding tests for payload formatting and error handling.
public void sendRegisterMessage(String username, String type, Long sid) {

saveProfileImage(profileImage, user);
log.info("success to register user_id={}", user.getId());

webhookService.sendRegisterMessage(user.getNickname(), "SignUp", user.getId());
Copy link

Copilot AI May 26, 2025

Choose a reason for hiding this comment

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

[nitpick] Webhook notifications are invoked in multiple services (UserService, OAuth2Service, StudyGroupService); extracting this logic into a shared utility or AOP advice could reduce duplication.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

바빠이자식아

private final RestTemplate restTemplate;

public void sendRegisterMessage(String username, String type, Long sid) {
String content = username + " 님이 " + type + " 방식으로 " + sid + "번째로 회원가입 하셨습니다!! 🎉";
Copy link

Copilot AI May 26, 2025

Choose a reason for hiding this comment

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

[nitpick] Hardcoding localized strings in code can hinder future localization; consider externalizing message templates or using a message source for maintainability.

Copilot uses AI. Check for mistakes.
Comment on lines +35 to +37
if (!StringUtils.hasText(webhookUrl)) {
log.debug("No webhook url provided");
return;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

webhook-prod.yml에만 노티 주소 넣었습니다.

나머지 스테이지면 무시하려고 한거고, 다른 구현 프랙티스는
스테이지마다 Bean을 다르게 생성하는건데 간단한 방법으로..

@github-actions
Copy link

github-actions bot commented May 26, 2025

Test Results

 18 files   18 suites   5s ⏱️
307 tests 307 ✅ 0 💤 0 ❌
309 runs  309 ✅ 0 💤 0 ❌

Results for commit 223e2f9.

♻️ This comment has been updated with latest results.

Copy link
Contributor

@rladmstn rladmstn left a comment

Choose a reason for hiding this comment

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

수고하셔슴ㄴ디ㅏ

@rladmstn
Copy link
Contributor

rladmstn commented Jun 6, 2025

걍 머지할게요

@rladmstn rladmstn merged commit 8748ebf into develop Jun 6, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-feature 기능 추가

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants