Skip to content

Commit

Permalink
feat: 소모임 반려 AlarmHistory 저장
Browse files Browse the repository at this point in the history
  • Loading branch information
minsu20 committed Dec 9, 2023
1 parent afc7e00 commit 3580b7a
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.moing.bo.backend.domain.team.application.service;

import com.moing.bo.backend.domain.history.application.service.SaveSingleAlarmHistoryUseCase;
import com.moing.bo.backend.domain.history.domain.entity.AlarmType;
import com.moing.bo.backend.domain.team.application.dto.response.GetLeaderInfoResponse;
import com.moing.bo.backend.domain.team.domain.service.TeamGetService;
import com.moing.bo.backend.domain.team.domain.service.TeamUpdateService;
Expand All @@ -12,6 +14,7 @@
import java.util.Collections;
import java.util.List;

import static com.moing.bo.backend.domain.history.domain.entity.PagePath.HOME_PATH;
import static com.moing.bo.backend.global.config.fcm.constant.ApproveTeamMessage.REJECT_TEAM_MESSAGE;

@Service
Expand All @@ -22,13 +25,16 @@ public class RejectTeamUseCase {
private final TeamUpdateService teamUpdateService;
private final TeamGetService teamGetService;
private final ApplicationEventPublisher eventPublisher;
private final SaveSingleAlarmHistoryUseCase saveAlarmHistoryUseCase;


public void rejectTeams(List<Long> teamIds) {
teamUpdateService.updateTeamStatus(false, teamIds);
List<GetLeaderInfoResponse> leaderInfos = teamGetService.getLeaderInfoResponses(teamIds);
for (GetLeaderInfoResponse info : leaderInfos) {
String title = REJECT_TEAM_MESSAGE.title(info.getLeaderName(), info.getTeamName());
String body = REJECT_TEAM_MESSAGE.body();
saveAlarmHistoryUseCase.saveAlarmHistory(info.getLeaderId(), "", title, body, info.getTeamName(), AlarmType.REJECT_TEAM, HOME_PATH.getValue());
eventPublisher.publishEvent(new FcmEvent(title, body, Collections.singletonList(info.getLeaderFcmToken())));
}
}
Expand Down

0 comments on commit 3580b7a

Please sign in to comment.