Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MNG-28 feat: 푸시 알림 보낼 떼 idInfo에 type 추가 #303

Merged
merged 1 commit into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import com.moing.backend.domain.history.application.dto.response.MemberIdAndToken;
import com.moing.backend.domain.history.application.dto.response.NewUploadInfo;
import com.moing.backend.domain.history.application.mapper.AlarmHistoryMapper;
import com.moing.backend.domain.history.domain.entity.AlarmType;
import com.moing.backend.domain.history.domain.entity.PagePath;
import com.moing.backend.domain.member.domain.entity.Member;
import com.moing.backend.domain.team.domain.entity.Team;
Expand All @@ -20,6 +19,7 @@
import java.util.List;
import java.util.Optional;

import static com.moing.backend.domain.history.domain.entity.AlarmType.NEW_UPLOAD;
import static com.moing.backend.global.config.fcm.constant.NewNoticeUploadMessage.NEW_NOTICE_UPLOAD_MESSAGE;

@Service
Expand All @@ -41,14 +41,15 @@ public void sendNewUploadAlarm(BaseServiceResponse baseServiceResponse, Board bo
Optional<List<MemberIdAndToken>> memberIdAndTokensByPush = AlarmHistoryMapper.getNewUploadPushInfo(newUploadInfos);
Optional<List<MemberIdAndToken>> memberIdAndTokensBySave = AlarmHistoryMapper.getNewUploadSaveInfo(newUploadInfos);
// 알림 보내기
eventPublisher.publishEvent(new MultiFcmEvent(title, body, memberIdAndTokensByPush, memberIdAndTokensBySave, createIdInfo(team.getTeamId(), board.getBoardId()), team.getName(), AlarmType.NEW_UPLOAD, PagePath.NOTICE_PATH.getValue()));
eventPublisher.publishEvent(new MultiFcmEvent(title, body, memberIdAndTokensByPush, memberIdAndTokensBySave, createIdInfo(team.getTeamId(), board.getBoardId()), team.getName(), NEW_UPLOAD, PagePath.NOTICE_PATH.getValue()));
}
}

private String createIdInfo(Long teamId, Long boardId) {
JSONObject jo = new JSONObject();
jo.put("teamId", teamId);
jo.put("boardId", boardId);
jo.put("type", "NEW_UPLOAD_BOARD");
return jo.toJSONString();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ private String createIdInfo(Long teamId, Long boardId) {
JSONObject jo = new JSONObject();
jo.put("teamId", teamId);
jo.put("boardId", boardId);
jo.put("type", "COMMENT");
return jo.toJSONString();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.moing.backend.domain.fire.application.service;

import com.moing.backend.domain.fire.application.dto.req.FireThrowReq;
import com.moing.backend.domain.history.domain.entity.AlarmType;
import com.moing.backend.domain.member.domain.entity.Member;
import com.moing.backend.domain.mission.domain.entity.Mission;
import com.moing.backend.domain.mission.domain.entity.constant.MissionType;
Expand All @@ -15,6 +14,7 @@
import javax.transaction.Transactional;
import java.util.Random;

import static com.moing.backend.domain.history.domain.entity.AlarmType.FIRE;
import static com.moing.backend.domain.history.domain.entity.PagePath.MISSION_PATH;
import static com.moing.backend.global.config.fcm.constant.FireThrowMessage.*;

Expand All @@ -35,7 +35,7 @@ public void sendFireThrowAlarm(Member throwMember, Member receiveMember, Team te
: getRandomMessage(throwMember.getNickName(), receiveMember.getNickName(), randomNum);
String idInfo = createIdInfo(mission.getType() == MissionType.REPEAT, mission.getTeam().getTeamId(), mission.getId());

eventPublisher.publishEvent(new SingleFcmEvent(receiveMember, title, message, idInfo, team.getName(), AlarmType.FIRE, MISSION_PATH.getValue(), receiveMember.isFirePush()));
eventPublisher.publishEvent(new SingleFcmEvent(receiveMember, title, message, idInfo, team.getName(), FIRE, MISSION_PATH.getValue(), receiveMember.isFirePush()));
}

public String getRandomMessage(String pusher, String receiver, int num) {
Expand Down Expand Up @@ -65,6 +65,7 @@ private String createIdInfo(boolean isRepeated, Long teamId, Long missionId) {
jo.put("isRepeated", isRepeated);
jo.put("teamId", teamId);
jo.put("missionId", missionId);
jo.put("type", "FIRE");
return jo.toJSONString();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.moing.backend.domain.history.application.dto.response.MemberIdAndToken;
import com.moing.backend.domain.history.application.dto.response.NewUploadInfo;
import com.moing.backend.domain.history.application.mapper.AlarmHistoryMapper;
import com.moing.backend.domain.history.domain.entity.AlarmType;
import com.moing.backend.domain.history.domain.entity.PagePath;
import com.moing.backend.domain.member.domain.entity.Member;
import com.moing.backend.domain.mission.domain.entity.Mission;
Expand All @@ -21,6 +20,7 @@
import java.util.List;
import java.util.Optional;

import static com.moing.backend.domain.history.domain.entity.AlarmType.NEW_UPLOAD;
import static com.moing.backend.global.config.fcm.constant.NewMissionTitle.NEW_SINGLE_MISSION_COMING;

@Service
Expand All @@ -43,7 +43,7 @@ public void sendNewMissionUploadAlarm(Member member, Mission mission) {
Optional<List<MemberIdAndToken>> memberIdAndTokensByPush = AlarmHistoryMapper.getNewUploadPushInfo(newUploadInfos);
Optional<List<MemberIdAndToken>> memberIdAndTokensBySave = AlarmHistoryMapper.getNewUploadSaveInfo(newUploadInfos);
// 알림 보내기
eventPublisher.publishEvent(new MultiFcmEvent(title, message, memberIdAndTokensByPush, memberIdAndTokensBySave, createIdInfo(team.getTeamId(), mission.getId(),mission.getType(),mission.getStatus()), team.getName(), AlarmType.NEW_UPLOAD, PagePath.MISSION_PATH.getValue()));
eventPublisher.publishEvent(new MultiFcmEvent(title, message, memberIdAndTokensByPush, memberIdAndTokensBySave, createIdInfo(team.getTeamId(), mission.getId(),mission.getType(),mission.getStatus()), team.getName(), NEW_UPLOAD, PagePath.MISSION_PATH.getValue()));
}

private String createIdInfo(Long teamId, Long missionId,MissionType type, MissionStatus status) {
Expand All @@ -52,6 +52,7 @@ private String createIdInfo(Long teamId, Long missionId,MissionType type, Missio
jo.put("teamId", teamId);
jo.put("missionId", missionId);
jo.put("status", status.name());
jo.put("type", "NEW_UPLOAD_MISSION");
return jo.toJSONString();
}
}
Expand Down
Loading