Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ public ResponseEntity<SocialLoginRes> socialLogin(
@Valid @RequestBody SocialLoginReq req
) {
SocialLoginRes res = authService.socialLogin(providerToken, req);
webhookService.sendNewUserNotification();
return ResponseEntity.ok(res);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import org.sopt.user.domain.User;
import org.sopt.user.facade.UserFacade;
import org.sopt.userprofile.domain.UserProfile;
import org.sopt.userprofile.facade.UserProfileFacade;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
Expand All @@ -23,19 +24,12 @@ public class WebhookService {
@Value("${discord.webhook.url}")
private String discordWebhookUrl;

private final UserFacade userFacade;

public void sendNewUserNotification() {
// 회원 수 조회
final long totalMembers = userFacade.count();

// 알림 메시지
String message = totalMembers + "번째 유저가 로그인했습니다!\n";
sendDiscordWebhook(message);
}
private final UserProfileFacade userProfileFacade;

public void sendCompleteUserNotification(UserProfile userProfile) {
String message = userProfile.getNickname() + "회원님이 회원가입을 완료했습니다!\n";
final long totalMembers = userProfileFacade.count();

String message = "✏️하이링구얼 신규 회원✏️\n🔸닉네임 : " + userProfile.getNickname() + "\n🔸현재 가입 유저 수 : " + totalMembers + "명\n🔸플랫폼 : " + userProfile.getUser().getProvider();
sendDiscordWebhook(message);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,4 @@ public void deleteUserById(final long userId) {
public boolean existsByProviderId(final String providerId) {
return userRetriever.existsByProviderId(providerId);
}

public long count() {
return userRetriever.count();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,4 @@ public boolean existsByProviderId(String providerId) {
return userRepository.existsByProviderId(providerId);
}

public long count() {
return userRepository.count();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,4 @@ public interface UserRepository extends JpaRepository<User, Long> {
// 탈퇴/삭제된 계정 제외 전체 유저 id
@Query("select u.id from User u where u.isDeleted = false")
List<Long> findAllActiveUserIds();

long count();
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ public List<UserSearchProjection> getUserListByNickname(Long userId, String keyw
return userProfileRetriever.findUsersByNickname(userId, keyword, startKeyword);
}

public long count() {
return userProfileRetriever.count();
}

/**
saver
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,8 @@ public boolean isNicknameExists(String nickname) {
public List<UserSearchProjection> findUsersByNickname(Long userId, String keyword, String startKeyword) {
return userProfileRepository.searchUserListByKeyword(userId, keyword, startKeyword);
}

public long count() {
return userProfileRepository.count();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,6 @@ int decrementFollowerCountByUserId(
@Modifying
@Query("UPDATE UserProfile up SET up.followingCount = up.followingCount - 1 WHERE up.user.id IN (SELECT f.follower.id FROM Follow f WHERE f.followee.id = :userId)")
void decreaseFollowingCountOfFollowers(@Param("userId") Long userId);

long count();
}