diff --git a/.gitignore b/.gitignore index 03d183bf..850b9ca6 100644 --- a/.gitignore +++ b/.gitignore @@ -53,3 +53,4 @@ data.sql firebase-key.json apple-key.p8 +logs/ \ No newline at end of file diff --git a/src/docs/asciidoc/AlarmHistory-API.adoc b/src/docs/asciidoc/AlarmHistory-API.adoc index 5c31a28d..c3ee6871 100644 --- a/src/docs/asciidoc/AlarmHistory-API.adoc +++ b/src/docs/asciidoc/AlarmHistory-API.adoc @@ -24,6 +24,8 @@ operation::alarm-history-controller-test/get_all_alarm_history[snippets='http-re | `REJECT_TEAM` | 소모임 반려 +| `COMMENT` +| 댓글 생성 알림 |=== [[AlarmHistory-알림-단건-조회하기]] diff --git a/src/main/java/com/moing/backend/domain/board/application/service/SendBoardAlarmUseCase.java b/src/main/java/com/moing/backend/domain/board/application/service/SendBoardAlarmUseCase.java index 3ed5f384..edb57a8c 100644 --- a/src/main/java/com/moing/backend/domain/board/application/service/SendBoardAlarmUseCase.java +++ b/src/main/java/com/moing/backend/domain/board/application/service/SendBoardAlarmUseCase.java @@ -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; @@ -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 @@ -41,7 +41,7 @@ public void sendNewUploadAlarm(BaseServiceResponse baseServiceResponse, Board bo Optional> memberIdAndTokensByPush = AlarmHistoryMapper.getNewUploadPushInfo(newUploadInfos); Optional> 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())); } } @@ -49,6 +49,7 @@ 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(); } diff --git a/src/main/java/com/moing/backend/domain/boardComment/application/service/CreateBoardCommentUseCase.java b/src/main/java/com/moing/backend/domain/boardComment/application/service/CreateBoardCommentUseCase.java index ffac8705..47fb22f0 100644 --- a/src/main/java/com/moing/backend/domain/boardComment/application/service/CreateBoardCommentUseCase.java +++ b/src/main/java/com/moing/backend/domain/boardComment/application/service/CreateBoardCommentUseCase.java @@ -21,7 +21,7 @@ public class CreateBoardCommentUseCase { private final BoardCommentSaveService boardCommentSaveService; private final BaseBoardService baseBoardService; private final CheckLeaderUseCase checkLeaderUseCase; - private final SendCommentAlarmUseCase sendCommentAlarmUseCase; + private final SendBoardCommentAlarmUseCase sendCommentAlarm; /** * 게시글 댓글 생성 */ @@ -33,7 +33,7 @@ public CreateCommentResponse createBoardComment(String socialId, Long teamId, Lo // 2. 게시글 댓글 개수 증가 data.getBoard().incrComNum(); // 3. 게시글 댓글 알림 - sendCommentAlarmUseCase.sendNewUploadAlarm(data, boardComment); + sendCommentAlarm.sendCommentAlarm(data, boardComment); return new CreateCommentResponse(boardComment.getBoardCommentId()); } } diff --git a/src/main/java/com/moing/backend/domain/boardComment/application/service/SendCommentAlarmUseCase.java b/src/main/java/com/moing/backend/domain/boardComment/application/service/SendBoardCommentAlarmUseCase.java similarity index 92% rename from src/main/java/com/moing/backend/domain/boardComment/application/service/SendCommentAlarmUseCase.java rename to src/main/java/com/moing/backend/domain/boardComment/application/service/SendBoardCommentAlarmUseCase.java index 84d1078a..7b6ae5e3 100644 --- a/src/main/java/com/moing/backend/domain/boardComment/application/service/SendCommentAlarmUseCase.java +++ b/src/main/java/com/moing/backend/domain/boardComment/application/service/SendBoardCommentAlarmUseCase.java @@ -28,12 +28,12 @@ @Service @RequiredArgsConstructor @Transactional -public class SendCommentAlarmUseCase { +public class SendBoardCommentAlarmUseCase { private final ApplicationEventPublisher eventPublisher; private final BoardCommentGetService boardCommentGetService; - public void sendNewUploadAlarm(BaseBoardServiceResponse response, BoardComment comment) { + public void sendCommentAlarm(BaseBoardServiceResponse response, BoardComment comment) { Member member = response.getMember(); Team team = response.getTeam(); Board board = response.getBoard(); @@ -50,7 +50,7 @@ private void sendBoardWriter(Board board, Member member, String title, String bo Member receiver = board.getTeamMember().getMember(); if (checkBoardWriter(receiver, member, newUploadInfos)) { - eventPublisher.publishEvent(new SingleFcmEvent(receiver, title, body, createIdInfo(team.getTeamId(), board.getBoardId()), team.getName(), AlarmType.NEW_UPLOAD, PagePath.NOTICE_PATH.getValue(), receiver.isNewUploadPush())); + eventPublisher.publishEvent(new SingleFcmEvent(receiver, title, body, createIdInfo(team.getTeamId(), board.getBoardId()), team.getName(), AlarmType.COMMENT, PagePath.NOTICE_PATH.getValue(), receiver.isCommentPush())); } } @@ -58,13 +58,14 @@ private void sendBoardCommentWriter(Board board, Member member, String title, St Optional> memberIdAndTokensByPush = AlarmHistoryMapper.getNewUploadPushInfo(newUploadInfos); Optional> 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(), AlarmType.COMMENT, 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", "COMMENT_BOARD"); return jo.toJSONString(); } diff --git a/src/main/java/com/moing/backend/domain/boardComment/domain/repository/BoardCommentCustomRepositoryImpl.java b/src/main/java/com/moing/backend/domain/boardComment/domain/repository/BoardCommentCustomRepositoryImpl.java index 413f4203..9ac674c3 100644 --- a/src/main/java/com/moing/backend/domain/boardComment/domain/repository/BoardCommentCustomRepositoryImpl.java +++ b/src/main/java/com/moing/backend/domain/boardComment/domain/repository/BoardCommentCustomRepositoryImpl.java @@ -69,7 +69,7 @@ public Optional> findNewUploadInfo(Long memberId, Long board List result = queryFactory.select(Projections.constructor(NewUploadInfo.class, boardComment.teamMember.member.fcmToken, boardComment.teamMember.member.memberId, - boardComment.teamMember.member.isNewUploadPush, + boardComment.teamMember.member.isCommentPush, boardComment.teamMember.member.isSignOut)) .distinct() .from(boardComment) diff --git a/src/main/java/com/moing/backend/domain/fire/application/dto/req/FireThrowReq.java b/src/main/java/com/moing/backend/domain/fire/application/dto/req/FireThrowReq.java new file mode 100644 index 00000000..34907e1b --- /dev/null +++ b/src/main/java/com/moing/backend/domain/fire/application/dto/req/FireThrowReq.java @@ -0,0 +1,17 @@ +package com.moing.backend.domain.fire.application.dto.req; + +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@NoArgsConstructor +@Getter +public class FireThrowReq { + + private String message; + + @Builder + public FireThrowReq(String message) { + this.message = message; + } +} diff --git a/src/main/java/com/moing/backend/domain/fire/application/service/FireThrowAlarmUseCase.java b/src/main/java/com/moing/backend/domain/fire/application/service/FireThrowAlarmUseCase.java index ca28e88a..0566dea0 100644 --- a/src/main/java/com/moing/backend/domain/fire/application/service/FireThrowAlarmUseCase.java +++ b/src/main/java/com/moing/backend/domain/fire/application/service/FireThrowAlarmUseCase.java @@ -1,6 +1,6 @@ package com.moing.backend.domain.fire.application.service; -import com.moing.backend.domain.history.domain.entity.AlarmType; +import com.moing.backend.domain.fire.application.dto.req.FireThrowReq; 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; @@ -14,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.*; @@ -24,28 +25,31 @@ public class FireThrowAlarmUseCase { private final ApplicationEventPublisher eventPublisher; - public void sendFireThrowAlarm(Member throwMember, Member receiveMember, Team team, Mission mission) { + public void sendFireThrowAlarm(Member throwMember, Member receiveMember, Team team, Mission mission, FireThrowReq fireThrowReq) { - Random random = new Random(System.currentTimeMillis()); - int randomNum = random.nextInt(2); + int randomNum = new Random(System.currentTimeMillis()).nextInt(2); - String title = getTitle(throwMember.getNickName(), receiveMember.getNickName(), randomNum); - String message = getMessage(throwMember.getNickName(), receiveMember.getNickName(), randomNum); - String idInfo = createIdInfo(mission.getType() == MissionType.REPEAT, mission.getTeam().getTeamId(), mission.getId()); + String title = fireThrowReq != null ? NEW_FIRE_THROW_TITLE_WITH_COMMENT.to(throwMember.getNickName()) + : getRandomTitle(throwMember.getNickName(), receiveMember.getNickName(), randomNum); + String message = fireThrowReq != null ? fireThrowReq.getMessage() + : getRandomMessage(throwMember.getNickName(), receiveMember.getNickName(), randomNum); + String idInfo = createIdInfo(mission.getType() == MissionType.REPEAT, mission.getTeam().getTeamId(), mission.getId(), fireThrowReq == null); - 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 getMessage(String pusher, String receiver, int num) { + public String getRandomMessage(String pusher, String receiver, int num) { switch (num) { - case 0: return pusher + "님이 " + receiver + NEW_FIRE_THROW_MESSAGE1.getMessage(); - case 1: return receiver + "님! " + pusher + NEW_FIRE_THROW_MESSAGE2.getMessage(); + case 0: + return NEW_FIRE_THROW_MESSAGE1.fromTo(pusher, receiver); + case 1: return NEW_FIRE_THROW_MESSAGE2.toFrom(receiver, pusher); + } - return pusher + "님이" + receiver + NEW_FIRE_THROW_MESSAGE1.getMessage(); + return NEW_FIRE_THROW_MESSAGE1.fromTo(pusher, receiver); } - public String getTitle(String pusher, String receiver, int num) { + public String getRandomTitle(String pusher, String receiver, int num) { switch (num) { case 0: @@ -56,13 +60,20 @@ public String getTitle(String pusher, String receiver, int num) { return NEW_FIRE_THROW_TITLE1.getMessage(); } - private String createIdInfo(boolean isRepeated, Long teamId, Long missionId) { + private String createIdInfo(boolean isRepeated, Long teamId, Long missionId, boolean isMessageNull) { JSONObject jo = new JSONObject(); jo.put("isRepeated", isRepeated); jo.put("teamId", teamId); jo.put("missionId", missionId); + jo.put("type", getType(isMessageNull)); return jo.toJSONString(); } + private String getType(boolean isMessageNull){ + if(isMessageNull) + return "FIRE_MESSAGE_NULL"; + return "FIRE_MESSAGE_EXIST"; + } + } diff --git a/src/main/java/com/moing/backend/domain/fire/application/service/FireThrowUseCase.java b/src/main/java/com/moing/backend/domain/fire/application/service/FireThrowUseCase.java index 7fd5015b..494a1c0d 100644 --- a/src/main/java/com/moing/backend/domain/fire/application/service/FireThrowUseCase.java +++ b/src/main/java/com/moing/backend/domain/fire/application/service/FireThrowUseCase.java @@ -1,5 +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.fire.application.dto.res.FireReceiveRes; import com.moing.backend.domain.fire.application.dto.res.FireThrowRes; import com.moing.backend.domain.fire.application.mapper.FireMapper; @@ -19,6 +20,7 @@ import org.springframework.transaction.annotation.Transactional; import java.util.List; +import java.util.Optional; @Service @Transactional @@ -33,7 +35,7 @@ public class FireThrowUseCase { private final MissionQueryService missionQueryService; private final TeamGetService teamGetService; - public FireThrowRes createFireThrow(String userId, Long receiveMemberId, Long missionId, Long teamId) { + public FireThrowRes createFireThrow(String userId, Long receiveMemberId, Long missionId, Long teamId, FireThrowReq fireThrowReq) { Member throwMember = memberGetService.getMemberBySocialId(userId); Member receiveMember = memberGetService.getMemberByMemberId(receiveMemberId); @@ -50,12 +52,14 @@ public FireThrowRes createFireThrow(String userId, Long receiveMemberId, Long mi throw new NoAuthThrowFireException(); } - fireThrowAlarmUseCase.sendFireThrowAlarm(throwMember, receiveMember, team, mission); + fireThrowAlarmUseCase.sendFireThrowAlarm(throwMember, receiveMember, team, mission, fireThrowReq); - return FireMapper.mapToFireThrowRes(fireSaveService.save(Fire.builder() + Fire save = fireSaveService.save(Fire.builder() .throwMemberId(throwMember.getMemberId()) .receiveMemberId(receiveMemberId) - .build())); + .build()); + + return FireMapper.mapToFireThrowRes(fireSaveService.save(save)); } public List getFireReceiveList(String userId,Long teamId, Long missionId) { diff --git a/src/main/java/com/moing/backend/domain/fire/domain/entity/Fire.java b/src/main/java/com/moing/backend/domain/fire/domain/entity/Fire.java index 9b32a630..8d6fe05c 100644 --- a/src/main/java/com/moing/backend/domain/fire/domain/entity/Fire.java +++ b/src/main/java/com/moing/backend/domain/fire/domain/entity/Fire.java @@ -15,7 +15,6 @@ @AllArgsConstructor public class Fire extends BaseTimeEntity { - @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "fire_id") diff --git a/src/main/java/com/moing/backend/domain/fire/presentation/FireController.java b/src/main/java/com/moing/backend/domain/fire/presentation/FireController.java index 5de8aa94..76eb46a5 100644 --- a/src/main/java/com/moing/backend/domain/fire/presentation/FireController.java +++ b/src/main/java/com/moing/backend/domain/fire/presentation/FireController.java @@ -1,5 +1,6 @@ package com.moing.backend.domain.fire.presentation; +import com.moing.backend.domain.fire.application.dto.req.FireThrowReq; import com.moing.backend.domain.fire.application.dto.res.FireReceiveRes; import com.moing.backend.domain.fire.application.dto.res.FireThrowRes; import com.moing.backend.domain.fire.application.service.FireThrowUseCase; @@ -30,8 +31,8 @@ public class FireController { @PostMapping("/{receiveMemberId}") public ResponseEntity> throwFire (@AuthenticationPrincipal User user, @PathVariable("teamId") Long teamId, - @PathVariable("receiveMemberId") Long receiveMemberId, @PathVariable("missionId") Long missionId) { - return ResponseEntity.ok(SuccessResponse.create(THROW_FIRE_SUCCESS.getMessage(), this.fireThrowUseCase.createFireThrow(user.getSocialId(), receiveMemberId, missionId, teamId))); + @PathVariable("receiveMemberId") Long receiveMemberId, @PathVariable("missionId") Long missionId, @RequestBody(required = false) FireThrowReq fireThrowReq) { + return ResponseEntity.ok(SuccessResponse.create(THROW_FIRE_SUCCESS.getMessage(), this.fireThrowUseCase.createFireThrow(user.getSocialId(), receiveMemberId, missionId, teamId, fireThrowReq))); } /** diff --git a/src/main/java/com/moing/backend/domain/history/domain/entity/AlarmType.java b/src/main/java/com/moing/backend/domain/history/domain/entity/AlarmType.java index fbf7fd58..e29851bf 100644 --- a/src/main/java/com/moing/backend/domain/history/domain/entity/AlarmType.java +++ b/src/main/java/com/moing/backend/domain/history/domain/entity/AlarmType.java @@ -8,5 +8,6 @@ public enum AlarmType { FIRE, REMIND, APPROVE_TEAM, - REJECT_TEAM + REJECT_TEAM, + COMMENT } diff --git a/src/main/java/com/moing/backend/domain/member/domain/entity/Member.java b/src/main/java/com/moing/backend/domain/member/domain/entity/Member.java index d13b5886..206847e1 100644 --- a/src/main/java/com/moing/backend/domain/member/domain/entity/Member.java +++ b/src/main/java/com/moing/backend/domain/member/domain/entity/Member.java @@ -79,6 +79,10 @@ public class Member extends BaseTimeEntity { @Column(nullable = false) private boolean isFirePush; + @ColumnDefault("true") + @Column(nullable = false) + private boolean isCommentPush; + private boolean isDeleted; private LocalDateTime lastSignInTime; @@ -140,10 +144,15 @@ public void updateFirePush(boolean firePush) { this.isFirePush = firePush; } + public void updateCommentPush(boolean commentPush){ + this.isCommentPush=commentPush; + } + public void updateAllPush(boolean allPush) { this.isNewUploadPush = allPush; this.isRemindPush = allPush; this.isFirePush = allPush; + this.isCommentPush=allPush; } public void updateFcmToken(String fcmToken) { diff --git a/src/main/java/com/moing/backend/domain/mission/application/service/SendMissionCreateAlarmUseCase.java b/src/main/java/com/moing/backend/domain/mission/application/service/SendMissionCreateAlarmUseCase.java index aabe793f..029f5420 100644 --- a/src/main/java/com/moing/backend/domain/mission/application/service/SendMissionCreateAlarmUseCase.java +++ b/src/main/java/com/moing/backend/domain/mission/application/service/SendMissionCreateAlarmUseCase.java @@ -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; @@ -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 @@ -43,7 +43,7 @@ public void sendNewMissionUploadAlarm(Member member, Mission mission) { Optional> memberIdAndTokensByPush = AlarmHistoryMapper.getNewUploadPushInfo(newUploadInfos); Optional> 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) { @@ -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(); } } diff --git a/src/main/java/com/moing/backend/domain/missionArchive/application/service/MissionArchiveCreateMessage.java b/src/main/java/com/moing/backend/domain/missionArchive/application/service/MissionArchiveCreateMessage.java new file mode 100644 index 00000000..bb3564b9 --- /dev/null +++ b/src/main/java/com/moing/backend/domain/missionArchive/application/service/MissionArchiveCreateMessage.java @@ -0,0 +1,22 @@ +package com.moing.backend.domain.missionArchive.application.service; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public enum MissionArchiveCreateMessage { + + CREATOR_CREATE_MISSION_ARCHIVE("%s님이 미션을 인증했어요!"), + TEAM_AND_TITLE("[%s] %s"); + + private final String message; + + public String to(String creator) { + return String.format(message, creator); + } + + public String teamAndTitle(String team, String title) { + return String.format(message, team, title); + } +} diff --git a/src/main/java/com/moing/backend/domain/missionArchive/application/service/MissionArchiveCreateUseCase.java b/src/main/java/com/moing/backend/domain/missionArchive/application/service/MissionArchiveCreateUseCase.java index 618a02c7..2979b706 100644 --- a/src/main/java/com/moing/backend/domain/missionArchive/application/service/MissionArchiveCreateUseCase.java +++ b/src/main/java/com/moing/backend/domain/missionArchive/application/service/MissionArchiveCreateUseCase.java @@ -34,6 +34,8 @@ public class MissionArchiveCreateUseCase { private final TeamScoreUpdateUseCase teamScoreUpdateUseCase; + private final SendMissionArchiveCreateAlarmUseCase sendMissionArchiveCreateAlarmUseCase; + public MissionArchiveRes createArchive(String userSocialId, Long missionId, MissionArchiveReq missionReq) { Member member = memberGetService.getMemberBySocialId(userSocialId); @@ -59,7 +61,6 @@ public MissionArchiveRes createArchive(String userSocialId, Long missionId, Miss newArchive.updateCount(missionArchiveQueryService.findMyDoneArchives(memberId, missionId) + 1); missionArchiveRes = MissionArchiveMapper.mapToMissionArchiveRes(missionArchiveSaveService.save(newArchive), memberId); - } // 한번 미션일 경우 @@ -78,13 +79,16 @@ public MissionArchiveRes createArchive(String userSocialId, Long missionId, Miss missionArchiveRes.updateCount(doneSingleArchives); } - // TODO : 소모임원 3명 이상일 경우 보너스 점수 + // 소모임원 3명 이상일 경우 보너스 점수 if (mission.getTeam().getNumOfMember() > 2) { gainBonusScore(mission, newArchive); } - // TODO : 미션 인증 1회당 점수 + // 미션 인증 1회당 점수 teamScoreUpdateUseCase.gainScoreOfArchive(mission, ScoreStatus.PLUS); + // 미션 인증 시 다른 팀원에게 알림 전송 + sendMissionArchiveCreateAlarmUseCase.sendNewMissionArchiveUploadAlarm(member,mission); + return missionArchiveRes; } diff --git a/src/main/java/com/moing/backend/domain/missionArchive/application/service/SendMissionArchiveCreateAlarmUseCase.java b/src/main/java/com/moing/backend/domain/missionArchive/application/service/SendMissionArchiveCreateAlarmUseCase.java new file mode 100644 index 00000000..fdba87a2 --- /dev/null +++ b/src/main/java/com/moing/backend/domain/missionArchive/application/service/SendMissionArchiveCreateAlarmUseCase.java @@ -0,0 +1,60 @@ +package com.moing.backend.domain.missionArchive.application.service; + +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; +import com.moing.backend.domain.mission.domain.entity.constant.MissionStatus; +import com.moing.backend.domain.mission.domain.entity.constant.MissionType; +import com.moing.backend.domain.team.domain.entity.Team; +import com.moing.backend.domain.teamMember.domain.service.TeamMemberGetService; +import com.moing.backend.global.config.fcm.dto.event.MultiFcmEvent; +import lombok.RequiredArgsConstructor; +import net.minidev.json.JSONObject; +import org.springframework.context.ApplicationEventPublisher; +import org.springframework.stereotype.Service; + +import javax.transaction.Transactional; +import java.util.List; +import java.util.Optional; + +import static com.moing.backend.domain.missionArchive.application.service.MissionArchiveCreateMessage.CREATOR_CREATE_MISSION_ARCHIVE; +import static com.moing.backend.domain.missionArchive.application.service.MissionArchiveCreateMessage.TEAM_AND_TITLE; + +@Service +@Transactional +@RequiredArgsConstructor +public class SendMissionArchiveCreateAlarmUseCase { + + private final TeamMemberGetService teamMemberGetService; + private final ApplicationEventPublisher eventPublisher; + + public void sendNewMissionArchiveUploadAlarm(Member member, Mission mission) { + Team team = mission.getTeam(); + + String title = CREATOR_CREATE_MISSION_ARCHIVE.to(member.getNickName()); + String message = TEAM_AND_TITLE.teamAndTitle(team.getName(),mission.getTitle()); + + + Optional> newUploadInfos=teamMemberGetService.getNewUploadInfo(team.getTeamId(), member.getMemberId()); + + Optional> memberIdAndTokensByPush = AlarmHistoryMapper.getNewUploadPushInfo(newUploadInfos); + Optional> 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())); + } + + private String createIdInfo(Long teamId, Long missionId,MissionType type, MissionStatus status) { + JSONObject jo = new JSONObject(); + jo.put("isRepeated", type.equals(MissionType.REPEAT)); + jo.put("teamId", teamId); + jo.put("missionId", missionId); + jo.put("status", status.name()); + jo.put("type", "COMPLETE_MISSION"); + return jo.toJSONString(); + } +} + diff --git a/src/main/java/com/moing/backend/domain/missionArchive/domain/repository/MissionArchiveCustomRepositoryImpl.java b/src/main/java/com/moing/backend/domain/missionArchive/domain/repository/MissionArchiveCustomRepositoryImpl.java index 5ef4b1f3..8d751358 100644 --- a/src/main/java/com/moing/backend/domain/missionArchive/domain/repository/MissionArchiveCustomRepositoryImpl.java +++ b/src/main/java/com/moing/backend/domain/missionArchive/domain/repository/MissionArchiveCustomRepositoryImpl.java @@ -329,7 +329,8 @@ public Optional> findTop5ArchivesByTeam(List .where(missionArchive.mission.team.teamId.in(teamIds), missionArchive.mission.way.eq(MissionWay.PHOTO), missionArchive.status.eq(MissionArchiveStatus.COMPLETE), - missionArchive.archive.ne("https://modagbul.s3.ap-northeast-2.amazonaws.com/reportImage.png")) + missionArchive.archive.ne("https://modagbul.s3.ap-northeast-2.amazonaws.com/reportImage.png"), + missionArchive.archive.ne("https://mo-ing.s3.ap-northeast-2.amazonaws.com/reportImage.png")) .orderBy(missionArchive.createdDate.desc()) .limit(14) .fetch(); diff --git a/src/main/java/com/moing/backend/domain/missionComment/application/service/CreateMissionCommentUseCase.java b/src/main/java/com/moing/backend/domain/missionComment/application/service/CreateMissionCommentUseCase.java index 54a0ef10..7e2a2bbc 100644 --- a/src/main/java/com/moing/backend/domain/missionComment/application/service/CreateMissionCommentUseCase.java +++ b/src/main/java/com/moing/backend/domain/missionComment/application/service/CreateMissionCommentUseCase.java @@ -1,6 +1,5 @@ package com.moing.backend.domain.missionComment.application.service; -import com.moing.backend.domain.boardComment.application.service.SendCommentAlarmUseCase; import com.moing.backend.domain.comment.application.dto.request.CreateCommentRequest; import com.moing.backend.domain.comment.application.dto.response.CreateCommentResponse; import com.moing.backend.domain.missionComment.application.mapper.MissionCommentMapper; @@ -22,7 +21,7 @@ public class CreateMissionCommentUseCase { private final MissionCommentSaveService missionCommentSaveService; private final BaseMissionService baseMissionService; private final CheckLeaderUseCase checkLeaderUseCase; - private final SendCommentAlarmUseCase sendCommentAlarmUseCase; + private final SendMissionCommentAlarmUseCase sendCommentAlarm; /** * 게시글 댓글 생성 */ @@ -33,8 +32,8 @@ public CreateCommentResponse createBoardComment(String socialId, Long teamId, Lo MissionComment missionComment = missionCommentSaveService.saveComment(MissionCommentMapper.toMissionComment(data.getTeamMember(), data.getMissionArchive(), createCommentRequest, isLeader)); // 2. 미션 게시글 댓글 개수 증가 data.getMissionArchive().incrComNum(); -// // 3. 미션 게시글 댓글 알림 -// sendCommentAlarmUseCase.sendNewUploadAlarm(data, missionComment); + // 3. 미션 게시글 댓글 알림 + sendCommentAlarm.sendCommentAlarm(data, missionComment); return new CreateCommentResponse(missionComment.getMissionCommentId()); } } diff --git a/src/main/java/com/moing/backend/domain/missionComment/application/service/SendMissionAlarmUseCase.java b/src/main/java/com/moing/backend/domain/missionComment/application/service/SendMissionAlarmUseCase.java deleted file mode 100644 index ced7594c..00000000 --- a/src/main/java/com/moing/backend/domain/missionComment/application/service/SendMissionAlarmUseCase.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.moing.backend.domain.missionComment.application.service; - -public class SendMissionAlarmUseCase { -} diff --git a/src/main/java/com/moing/backend/domain/missionComment/application/service/SendMissionCommentAlarmUseCase.java b/src/main/java/com/moing/backend/domain/missionComment/application/service/SendMissionCommentAlarmUseCase.java new file mode 100644 index 00000000..ec809470 --- /dev/null +++ b/src/main/java/com/moing/backend/domain/missionComment/application/service/SendMissionCommentAlarmUseCase.java @@ -0,0 +1,93 @@ +package com.moing.backend.domain.missionComment.application.service; + +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; +import com.moing.backend.domain.mission.domain.entity.constant.MissionType; +import com.moing.backend.domain.missionArchive.domain.entity.MissionArchive; +import com.moing.backend.domain.missionComment.domain.entity.MissionComment; +import com.moing.backend.domain.missionComment.domain.service.MissionCommentGetService; +import com.moing.backend.domain.team.domain.entity.Team; +import com.moing.backend.global.config.fcm.dto.event.MultiFcmEvent; +import com.moing.backend.global.config.fcm.dto.event.SingleFcmEvent; +import com.moing.backend.global.response.BaseMissionServiceResponse; +import lombok.RequiredArgsConstructor; +import net.minidev.json.JSONObject; +import org.springframework.context.ApplicationEventPublisher; +import org.springframework.stereotype.Service; + +import javax.transaction.Transactional; +import java.util.List; +import java.util.Objects; +import java.util.Optional; + +import static com.moing.backend.global.config.fcm.constant.NewCommentUploadMessage.NEW_COMMENT_UPLOAD_MESSAGE; + +@Service +@RequiredArgsConstructor +@Transactional +public class SendMissionCommentAlarmUseCase { + + private final ApplicationEventPublisher eventPublisher; + private final MissionCommentGetService missionCommentGetService; + + public void sendCommentAlarm(BaseMissionServiceResponse response, MissionComment comment) { + Member member = response.getMember(); + Team team = response.getTeam(); + MissionArchive missionArchive = response.getMissionArchive(); + Mission mission = missionArchive.getMission(); + + Optional> newUploadInfos = missionCommentGetService.getNewUploadInfo(member.getMemberId(), missionArchive.getId()); + String title = NEW_COMMENT_UPLOAD_MESSAGE.title(comment.getContent()); + String body = NEW_COMMENT_UPLOAD_MESSAGE.body(member.getNickName(), mission.getTitle()); + + sendMissionCommentWriter(mission, missionArchive, title, body, team, newUploadInfos); + sendMissionWriter(missionArchive, mission, member, title, body, team, newUploadInfos); + } + private void sendMissionWriter(MissionArchive missionArchive, Mission mission, + Member member, String title, String body, Team team, + Optional> newUploadInfos) { + Member receiver = missionArchive.getMember(); + if (checkMemberWriter(receiver, member, newUploadInfos)) { + eventPublisher.publishEvent(new SingleFcmEvent(receiver, title, body, createIdInfo(team.getTeamId(), mission.getId(), missionArchive.getId(),mission.getType()), team.getName(), AlarmType.COMMENT, PagePath.MISSION_PATH.getValue(), receiver.isCommentPush())); + } + } + + private void sendMissionCommentWriter(Mission mission, MissionArchive missionArchive, + String title, String body, Team team, + Optional> newUploadInfos) { + Optional> memberIdAndTokensByPush = AlarmHistoryMapper.getNewUploadPushInfo(newUploadInfos); + Optional> memberIdAndTokensBySave = AlarmHistoryMapper.getNewUploadSaveInfo(newUploadInfos); + + eventPublisher.publishEvent(new MultiFcmEvent(title, body, memberIdAndTokensByPush, memberIdAndTokensBySave, createIdInfo(team.getTeamId(), mission.getId(), missionArchive.getId(),mission.getType()), team.getName(), AlarmType.COMMENT, PagePath.MISSION_PATH.getValue())); + } + + + private boolean checkMemberWriter(Member missionWriter, Member commentWriter, Optional> newUploadInfos) { + // 댓글 작성자와 미션 게시글 작성자가 동일한 경우 알림을 보내지 않는다. + if (Objects.equals(missionWriter.getMemberId(), commentWriter.getMemberId())) { + return false; + } + + // newUploadInfos 리스트에 missionWriter memberId가 없는 경우만 알림을 보낸다. + // 리스트가 비어있거나, missionWriter의 memberId가 리스트에 없으면 true를 반환. + return newUploadInfos + .map(infos -> infos.stream().noneMatch(info -> info.getMemberId().equals(missionWriter.getMemberId()))) + .orElse(true); + } + + + private String createIdInfo(Long teamId, Long missionId, Long missionArchiveId, MissionType missionType) { + JSONObject jo = new JSONObject(); + jo.put("missionArchiveId", missionArchiveId); + jo.put("teamId", teamId); + jo.put("missionId", missionId); + jo.put("type", "COMMENT_MISSION"); + jo.put("isRepeated", missionType.equals(MissionType.REPEAT)); + return jo.toJSONString(); + } +} \ No newline at end of file diff --git a/src/main/java/com/moing/backend/domain/missionComment/domain/repository/MissionCommentCustomRepositoryImpl.java b/src/main/java/com/moing/backend/domain/missionComment/domain/repository/MissionCommentCustomRepositoryImpl.java index aecacdad..9e295ee7 100644 --- a/src/main/java/com/moing/backend/domain/missionComment/domain/repository/MissionCommentCustomRepositoryImpl.java +++ b/src/main/java/com/moing/backend/domain/missionComment/domain/repository/MissionCommentCustomRepositoryImpl.java @@ -69,7 +69,7 @@ public Optional> findNewUploadInfo(Long memberId, Long missi List result = queryFactory.select(Projections.constructor(NewUploadInfo.class, missionComment.teamMember.member.fcmToken, missionComment.teamMember.member.memberId, - missionComment.teamMember.member.isNewUploadPush, + missionComment.teamMember.member.isCommentPush, missionComment.teamMember.member.isSignOut)) .distinct() .from(missionComment) diff --git a/src/main/java/com/moing/backend/domain/mypage/application/dto/response/GetAlarmResponse.java b/src/main/java/com/moing/backend/domain/mypage/application/dto/response/GetAlarmResponse.java index 8d7e602c..9e858a34 100644 --- a/src/main/java/com/moing/backend/domain/mypage/application/dto/response/GetAlarmResponse.java +++ b/src/main/java/com/moing/backend/domain/mypage/application/dto/response/GetAlarmResponse.java @@ -4,7 +4,6 @@ import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; -import org.hibernate.annotations.ColumnDefault; @Builder @AllArgsConstructor @@ -15,4 +14,5 @@ public class GetAlarmResponse { private boolean isNewUploadPush; private boolean isRemindPush; private boolean isFirePush; + private boolean isCommentPush; } diff --git a/src/main/java/com/moing/backend/domain/mypage/application/service/AlarmUseCase.java b/src/main/java/com/moing/backend/domain/mypage/application/service/AlarmUseCase.java index e632e679..5d7c7e78 100644 --- a/src/main/java/com/moing/backend/domain/mypage/application/service/AlarmUseCase.java +++ b/src/main/java/com/moing/backend/domain/mypage/application/service/AlarmUseCase.java @@ -17,7 +17,7 @@ public class AlarmUseCase { @Transactional(readOnly = true) public GetAlarmResponse getAlarm(String socialId){ Member member=memberGetService.getMemberBySocialId(socialId); - return new GetAlarmResponse(member.isNewUploadPush(),member.isRemindPush(), member.isFirePush()); + return new GetAlarmResponse(member.isNewUploadPush(),member.isRemindPush(), member.isFirePush(), member.isCommentPush()); } @Transactional @@ -38,9 +38,11 @@ public GetAlarmResponse updateAlarm(String socialId, String type, String status) case "isFirePush": member.updateFirePush(push); break; + case "isCommentPush": + member.updateCommentPush(push); default: throw new AlarmInvalidException(); } - return new GetAlarmResponse(member.isNewUploadPush(),member.isRemindPush(), member.isFirePush()); + return new GetAlarmResponse(member.isNewUploadPush(),member.isRemindPush(), member.isFirePush(), member.isCommentPush()); } } diff --git a/src/main/java/com/moing/backend/domain/mypage/presentation/MyPageController.java b/src/main/java/com/moing/backend/domain/mypage/presentation/MyPageController.java index bea13408..f03563aa 100644 --- a/src/main/java/com/moing/backend/domain/mypage/presentation/MyPageController.java +++ b/src/main/java/com/moing/backend/domain/mypage/presentation/MyPageController.java @@ -107,7 +107,7 @@ public ResponseEntity> getAlarm(@Authenticatio /** * 알림정보 수정 - * [POST] api/mypage/alarm?type=all || isNewUploadPush || isRemindPush || isFirePush && status= on || off + * [POST] api/mypage/alarm?type=all || isNewUploadPush || isRemindPush || isFirePush || isCommentPush && status= on || off */ @PutMapping("/alarm") public ResponseEntity> updateAlarm(@AuthenticationPrincipal User user, diff --git a/src/main/java/com/moing/backend/domain/report/presentation/constant/ReportResponseMessage.java b/src/main/java/com/moing/backend/domain/report/presentation/constant/ReportResponseMessage.java index e5d9133a..a7332498 100644 --- a/src/main/java/com/moing/backend/domain/report/presentation/constant/ReportResponseMessage.java +++ b/src/main/java/com/moing/backend/domain/report/presentation/constant/ReportResponseMessage.java @@ -9,7 +9,7 @@ public enum ReportResponseMessage { CREATE_REPORT_SUCCESS("게시글 신고를 완료 했습니다."), REPORT_MESSAGE("신고 접수로 삭제되었습니다."), - REPORT_PHOTO("https://modagbul.s3.ap-northeast-2.amazonaws.com/reportImage.png"); + REPORT_PHOTO("https://mo-ing.s3.ap-northeast-2.amazonaws.com/reportImage.png"); private final String message; diff --git a/src/main/java/com/moing/backend/global/config/fcm/constant/FireThrowMessage.java b/src/main/java/com/moing/backend/global/config/fcm/constant/FireThrowMessage.java index dbfb2f79..ef720ec8 100644 --- a/src/main/java/com/moing/backend/global/config/fcm/constant/FireThrowMessage.java +++ b/src/main/java/com/moing/backend/global/config/fcm/constant/FireThrowMessage.java @@ -10,14 +10,24 @@ public enum FireThrowMessage { NEW_FIRE_THROW_TITLE1("어라… 왜 이렇게 발등이 뜨겁지?\uD83E\uDD28"), NEW_FIRE_THROW_TITLE2("⚠\uFE0F불조심⚠\uFE0F "), + NEW_FIRE_THROW_TITLE_WITH_COMMENT("%s님이 불을 던졌어요!"), - NEW_FIRE_THROW_MESSAGE1("님에게 불을 던졌어요! 어서 미션을 인증해볼까요?"), - NEW_FIRE_THROW_MESSAGE2("님이 던진 불에 타버릴지도 몰라요! 어서 인증하러갈까요?"); - + NEW_FIRE_THROW_MESSAGE1("%s님이 %s님에게 불을 던졌어요! 어서 미션을 인증해볼까요?"), + NEW_FIRE_THROW_MESSAGE2("%s님! %s님이 던진 불에 타버릴지도 몰라요! 어서 인증하러갈까요?"); private final String message; + public String to(String pusher) { + return String.format(message, pusher); + } + public String fromTo(String pusher,String receiver) { + return String.format(message, pusher,receiver); + } + public String toFrom(String receiver,String pusher) { + return String.format(message, receiver,pusher); + } + } diff --git a/src/test/java/com/moing/backend/domain/fire/representation/FireControllerTest.java b/src/test/java/com/moing/backend/domain/fire/representation/FireControllerTest.java index 0cdd119b..1ee71150 100644 --- a/src/test/java/com/moing/backend/domain/fire/representation/FireControllerTest.java +++ b/src/test/java/com/moing/backend/domain/fire/representation/FireControllerTest.java @@ -1,10 +1,12 @@ package com.moing.backend.domain.fire.representation; import com.moing.backend.config.CommonControllerTest; +import com.moing.backend.domain.fire.application.dto.req.FireThrowReq; import com.moing.backend.domain.fire.application.dto.res.FireReceiveRes; import com.moing.backend.domain.fire.application.dto.res.FireThrowRes; import com.moing.backend.domain.fire.application.service.FireThrowUseCase; import com.moing.backend.domain.fire.presentation.FireController; +import com.moing.backend.domain.missionArchive.application.dto.req.MissionArchiveReq; import org.assertj.core.util.Lists; import org.junit.jupiter.api.Test; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; @@ -22,8 +24,7 @@ import static org.mockito.BDDMockito.given; import static org.springframework.restdocs.headers.HeaderDocumentation.headerWithName; import static org.springframework.restdocs.headers.HeaderDocumentation.requestHeaders; -import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath; -import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields; +import static org.springframework.restdocs.payload.PayloadDocumentation.*; import static org.springframework.restdocs.request.RequestDocumentation.parameterWithName; import static org.springframework.restdocs.request.RequestDocumentation.pathParameters; @@ -89,11 +90,17 @@ public class FireControllerTest extends CommonControllerTest { public void 불_던지기() throws Exception { //given + FireThrowReq input = FireThrowReq.builder() + .message("불던지기 메시지. 메시지가 없는경우 DTO 자체를 전송하지 않음") + .build(); + + String body = objectMapper.writeValueAsString(input); + FireThrowRes output = FireThrowRes.builder() .receiveMemberId(1L) .build(); - given(fireThrowUseCase.createFireThrow(any(), any(), any(), any())).willReturn(output); + given(fireThrowUseCase.createFireThrow(any(), any(), any(), any(),any())).willReturn(output); Long teamId = 2L; Long missionId = 2L; @@ -103,6 +110,7 @@ public class FireControllerTest extends CommonControllerTest { post("/api/team/{teamId}/missions/{missionId}/fire/{receiveMemberId}",teamId,missionId,receiveMemberId) .header("Authorization", "Bearer ACCESS_TOKEN") .contentType(MediaType.APPLICATION_JSON) + .content(body) ); //then @@ -118,7 +126,9 @@ public class FireControllerTest extends CommonControllerTest { parameterWithName("missionId").description("미션 아이디"), parameterWithName("receiveMemberId").description("불 받을 사람 아이디") ), - + requestFields( + fieldWithPath("message").description("불던지기 메시지. 메시지가 없는경우 DTO 자체를 전송하지 않음") + ), responseFields( fieldWithPath("isSuccess").description("true"), fieldWithPath("message").description(THROW_FIRE_SUCCESS.getMessage()), diff --git a/src/test/java/com/moing/backend/domain/mypage/presentation/MypageControllerTest.java b/src/test/java/com/moing/backend/domain/mypage/presentation/MypageControllerTest.java index f4d06b55..d2ea767c 100644 --- a/src/test/java/com/moing/backend/domain/mypage/presentation/MypageControllerTest.java +++ b/src/test/java/com/moing/backend/domain/mypage/presentation/MypageControllerTest.java @@ -257,6 +257,7 @@ public void get_alarm() throws Exception { .isNewUploadPush(true) .isFirePush(true) .isRemindPush(true) + .isCommentPush(true) .build(); given(alarmUseCase.getAlarm(any())).willReturn(output); @@ -282,7 +283,8 @@ public void get_alarm() throws Exception { fieldWithPath("message").description("알람 정보를 조회했습니다"), fieldWithPath("data.newUploadPush").description("신규 공지 알림"), fieldWithPath("data.remindPush").description("미션 리마인드 알림"), - fieldWithPath("data.firePush").description("불 던지기 알림") + fieldWithPath("data.firePush").description("불 던지기 알림"), + fieldWithPath("data.commentPush").description("댓글 알림") ) ) ); @@ -295,6 +297,7 @@ public void update_alarm() throws Exception { .isNewUploadPush(true) .isFirePush(true) .isRemindPush(true) + .isCommentPush(true) .build(); given(alarmUseCase.updateAlarm(any(),any(),any())).willReturn(output); @@ -326,7 +329,9 @@ public void update_alarm() throws Exception { fieldWithPath("message").description("알람 정보를 수정했습니다"), fieldWithPath("data.newUploadPush").description("신규 공지 알림"), fieldWithPath("data.remindPush").description("미션 리마인드 알림"), - fieldWithPath("data.firePush").description("불 던지기 알림") + fieldWithPath("data.firePush").description("불 던지기 알림"), + fieldWithPath("data.commentPush").description("댓글 알림") + ) ) );