Skip to content

Commit

Permalink
refactor: EntryAlertResultHandler 네이밍 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
xxeol2 committed Oct 4, 2023
1 parent e253317 commit 78e5820
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
public class EntryAlertFcmClient {

private final FcmClient fcmClient;
private final EntryAlertStatusService entryAlertStatusService;
private final EntryAlertResultHandler entryAlertResultHandler;

public EntryAlertFcmClient(FcmClient fcmClient, EntryAlertStatusService entryAlertStatusService) {
public EntryAlertFcmClient(FcmClient fcmClient, EntryAlertResultHandler entryAlertResultHandler) {
this.fcmClient = fcmClient;
this.entryAlertStatusService = entryAlertStatusService;
this.entryAlertResultHandler = entryAlertResultHandler;
}

@Async
public void sendAll(Long entryAlertId, List<String> tokens, FCMChannel channel, FcmPayload fcmPayload) {
boolean isSuccess = fcmClient.sendAll(tokens, channel, fcmPayload);
entryAlertStatusService.updateRequestedEntryAlertStatus(entryAlertId, isSuccess);
entryAlertResultHandler.handle(entryAlertId, isSuccess);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
import org.springframework.transaction.annotation.Transactional;

@Service
public class EntryAlertStatusService {
public class EntryAlertResultHandler {

private final EntryAlertRepository entryAlertRepository;

public EntryAlertStatusService(EntryAlertRepository entryAlertRepository) {
public EntryAlertResultHandler(EntryAlertRepository entryAlertRepository) {
this.entryAlertRepository = entryAlertRepository;
}

@Transactional
public void updateRequestedEntryAlertStatus(Long entryAlertId, boolean isSuccess) {
public void handle(Long entryAlertId, boolean isSuccess) {
EntryAlert entryAlert = entryAlertRepository.findById(entryAlertId)
.orElseThrow(() -> new NotFoundException(ErrorCode.ENTRY_ALERT_NOT_FOUND));
if (isSuccess) {
Expand Down

0 comments on commit 78e5820

Please sign in to comment.