Skip to content

Commit

Permalink
refactor(NotificationSetting): ToggleNotificationSettingUseCase -> Ma…
Browse files Browse the repository at this point in the history
…nageNotificationSettingUseCase 변경
  • Loading branch information
limehee committed Nov 17, 2024
1 parent 3e78f20 commit 02c0ca9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@
import org.springframework.web.bind.annotation.RestController;
import page.clab.api.global.common.dto.ApiResponse;
import page.clab.api.global.common.notificationSetting.application.dto.request.NotificationSettingToggleRequestDto;
import page.clab.api.global.common.notificationSetting.application.port.in.ToggleNotificationSettingUseCase;
import page.clab.api.global.common.notificationSetting.application.port.in.ManageNotificationSettingUseCase;

@RestController
@RequestMapping("/api/v1/notification-settings")
@RequiredArgsConstructor
@Tag(name = "Notification Setting", description = "웹훅 알림 설정")
public class NotificationSettingToggleController {

private final ToggleNotificationSettingUseCase toggleNotificationSettingUseCase;
private final ManageNotificationSettingUseCase manageNotificationSettingUseCase;

@Operation(summary = "[S] 웹훅 알림 설정 변경", description = "ROLE_SUPER 이상의 권한이 필요함")
@PreAuthorize("hasRole('SUPER')")
@PutMapping("")
public ApiResponse<Void> toggleNotificationSetting(
@Valid @RequestBody NotificationSettingToggleRequestDto requestDto
) {
toggleNotificationSettingUseCase.toggleNotificationSetting(requestDto.getAlertType(), requestDto.isEnabled());
manageNotificationSettingUseCase.toggleNotificationSetting(requestDto.getAlertType(), requestDto.isEnabled());
return ApiResponse.success();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;
import page.clab.api.global.common.notificationSetting.application.port.in.ToggleNotificationSettingUseCase;
import page.clab.api.global.common.notificationSetting.application.port.in.ManageNotificationSettingUseCase;
import page.clab.api.global.common.notificationSetting.application.port.out.NotificationSender;
import page.clab.api.global.common.notificationSetting.config.NotificationConfigProperties;
import page.clab.api.global.common.notificationSetting.config.NotificationConfigProperties.PlatformConfig;
Expand All @@ -20,15 +20,15 @@
@Slf4j
public class NotificationListener {

private final ToggleNotificationSettingUseCase toggleNotificationSettingUseCase;
private final ManageNotificationSettingUseCase manageNotificationSettingUseCase;
private final Map<String, NotificationSender> notificationSenders;
private final NotificationConfigProperties notificationConfigProperties;

public NotificationListener(
ToggleNotificationSettingUseCase toggleNotificationSettingUseCase,
ManageNotificationSettingUseCase manageNotificationSettingUseCase,
List<NotificationSender> notificationSenderList,
NotificationConfigProperties notificationConfigProperties) {
this.toggleNotificationSettingUseCase = toggleNotificationSettingUseCase;
this.manageNotificationSettingUseCase = manageNotificationSettingUseCase;
this.notificationConfigProperties = notificationConfigProperties;
this.notificationSenders = notificationSenderList.stream()
.collect(Collectors.toMap(NotificationSender::getPlatformName, Function.identity()));
Expand All @@ -38,7 +38,7 @@ public NotificationListener(
public void handleNotificationEvent(NotificationEvent event) {
AlertType alertType = event.getAlertType();

NotificationSetting setting = toggleNotificationSettingUseCase.getOrCreateDefaultSetting(alertType);
NotificationSetting setting = manageNotificationSettingUseCase.getOrCreateDefaultSetting(alertType);
if (!setting.isEnabled()) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import page.clab.api.global.common.notificationSetting.domain.AlertType;
import page.clab.api.global.common.notificationSetting.domain.NotificationSetting;

public interface ToggleNotificationSettingUseCase {
public interface ManageNotificationSettingUseCase {

void toggleNotificationSetting(String alertTypeName, boolean enabled);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import page.clab.api.global.common.notificationSetting.application.port.in.ToggleNotificationSettingUseCase;
import page.clab.api.global.common.notificationSetting.application.port.in.ManageNotificationSettingUseCase;
import page.clab.api.global.common.notificationSetting.application.port.out.RetrieveNotificationSettingPort;
import page.clab.api.global.common.notificationSetting.application.port.out.UpdateNotificationSettingPort;
import page.clab.api.global.common.notificationSetting.domain.AlertType;
Expand All @@ -24,7 +24,7 @@
*/
@Service
@RequiredArgsConstructor
public class ToggleNotificationSettingService implements ToggleNotificationSettingUseCase {
public class ManageNotificationSettingService implements ManageNotificationSettingUseCase {

private final AlertTypeResolver alertTypeResolver;
private final RetrieveNotificationSettingPort retrieveNotificationSettingPort;
Expand Down

0 comments on commit 02c0ca9

Please sign in to comment.