Skip to content

Commit

Permalink
Merge pull request #303 from Modagbul/MNG-28
Browse files Browse the repository at this point in the history
MNG-28 feat: 푸시 알림 보낼 떼 idInfo에 type 추가
  • Loading branch information
seungueonn authored Aug 9, 2024
2 parents 29dc9f3 + 9b3a081 commit 75c31fa
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
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

0 comments on commit 75c31fa

Please sign in to comment.