Skip to content

Commit

Permalink
Merge pull request #91 from Modagbul/fix/auth
Browse files Browse the repository at this point in the history
fix: fcmService 의존하게 수정
  • Loading branch information
minsu20 authored Nov 26, 2023
2 parents bf37371 + 3c03f17 commit f4d9356
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;
import org.checkerframework.checker.units.qual.A;

@Getter
@Setter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
import com.moing.backend.domain.team.application.dto.response.GetLeaderInfoResponse;
import com.moing.backend.domain.team.domain.service.TeamGetService;
import com.moing.backend.domain.team.domain.service.TeamUpdateService;
import com.moing.backend.global.config.fcm.FcmConfig;
import com.moing.backend.global.config.fcm.dto.event.FcmEvent;
import com.moing.backend.global.config.fcm.dto.request.SingleRequest;
import com.moing.backend.global.config.fcm.service.FcmService;
import lombok.RequiredArgsConstructor;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Service;
Expand All @@ -21,15 +24,15 @@ public class ApproveTeamUseCase {

private final TeamUpdateService teamUpdateService;
private final TeamGetService teamGetService;
private final ApplicationEventPublisher eventPublisher;
private final FcmService fcmService;

public void approveTeams(List<Long> teamIds){
teamUpdateService.updateTeamStatus(true, teamIds);
List<GetLeaderInfoResponse> leaderInfos=teamGetService.getLeaderInfoResponses(teamIds);
for(GetLeaderInfoResponse info: leaderInfos){
String title=APPROVE_TEAM_MESSAGE.title(info.getLeaderName(), info.getTeamName());
String body= APPROVE_TEAM_MESSAGE.body();
eventPublisher.publishEvent(new FcmEvent(title, body, Collections.singletonList(info.getLeaderFcmToken())));
fcmService.sendSingleDevice(new SingleRequest(info.getLeaderFcmToken(), title, body));
}
}
}

0 comments on commit f4d9356

Please sign in to comment.