Skip to content

Commit

Permalink
fix: 회원가입 시 강제 구독 삭제 (#1002)
Browse files Browse the repository at this point in the history
* fix: 회원가입 시 강제 구독 삭제

* fix: 모든 회원이 아닌 device 토큰이 존재하는 회원만 추가하도록 변경

* chore: 미사용 코드 삭제

* chore: 개행추가
  • Loading branch information
krSeonghyeon authored Nov 7, 2024
1 parent 46802a9 commit 9e81d6d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ public class StudentEventListener {

private final SlackClient slackClient;
private final SlackNotificationFactory slackNotificationFactory;
private final NotificationService notificationService;

@TransactionalEventListener(phase = AFTER_COMMIT)
public void onStudentEmailRequest(StudentEmailRequestEvent event) {
Expand All @@ -32,7 +31,5 @@ public void onStudentEmailRequest(StudentEmailRequestEvent event) {
public void onStudentRegister(StudentRegisterEvent event) {
var notification = slackNotificationFactory.generateStudentRegisterCompleteNotification(event.email());
slackClient.sendMessage(notification);

notificationService.permitNotificationSubscribe(event.studentId(), NotificationSubscribeType.REVIEW_PROMPT);
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package in.koreatech.koin.domain.student.model;

public record StudentRegisterEvent(
String email,
Integer studentId
String email
) {

}
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public ModelAndView authenticate(AuthTokenRequest request) {
userRepository.save(student.getUser());

studentRedisRepository.deleteById(student.getUser().getEmail());
eventPublisher.publishEvent(new StudentRegisterEvent(student.getUser().getEmail(), student.getId()));
eventPublisher.publishEvent(new StudentRegisterEvent(student.getUser().getEmail()));

return new ModelAndView("success_register_config");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
DELETE FROM notification_subscribe
WHERE subscribe_type = 'REVIEW_PROMPT';

INSERT INTO notification_subscribe (created_at, updated_at, subscribe_type, user_id)
SELECT NOW(), NOW(), 'REVIEW_PROMPT', s.user_id
FROM students s
JOIN users u ON s.user_id = u.id
WHERE u.device_token IS NOT NULL;

0 comments on commit 9e81d6d

Please sign in to comment.