Skip to content

Commit

Permalink
[FEATURE] 알림 테스트 기능 추가, 알림에 url 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
wnehgus101 committed Aug 21, 2024
1 parent 38b34f8 commit 5800d5e
Showing 1 changed file with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,11 @@ public void updateNoticeAndMatchKeyword(){

alarmRepository.save(alarm);

fcmService.sendFCMMessage(alarm, keyword.getKeyword());
Map<String, Object> noticeDetails = getNoticeDetails(alarm.getNoticeType(), alarm.getNoticeID());

String url = (String) noticeDetails.get("url");

fcmService.sendFCMMessage(alarm, keyword.getKeyword(), url);
} catch (Exception e) {
throw new RuntimeException("유저 알림을 저장하거나, fcm 알림을 보내는 도중 오류가 발생했습니다.", e);
}
Expand Down Expand Up @@ -109,7 +113,7 @@ public void updateNoticeAndMatchKeyword(){
}
}

public void updateNoticeAndMatchKeywordTest(){
public void updateNoticeAndMatchKeywordTest(String ssaid, String key){
List<CrawlingNum> crawlingNums;

try {
Expand All @@ -119,6 +123,9 @@ public void updateNoticeAndMatchKeywordTest(){
}

for (CrawlingNum crawlingNum : crawlingNums) {
crawlingNum.setNoticeID(0L);
crawlingNumRepository.save(crawlingNum);

List<AllNoticesView> allNoticesViews;

try {
Expand All @@ -136,7 +143,14 @@ public void updateNoticeAndMatchKeywordTest(){
try{
Alarm alarm = new Alarm(notice.getId(), notice.getTableName(), keyword.getUser(), notice.getTitle(), keyword.getKeyword());

fcmService.sendFCMMessage(alarm, keyword.getKeyword());
Map<String, Object> noticeDetails = getNoticeDetails(alarm.getNoticeType(), alarm.getNoticeID());

String url = (String) noticeDetails.get("url");

if (ssaid.equals(keyword.getUser().getSsaid()) && key.equals(keyword.getKeyword())){
fcmService.sendFCMMessage(alarm, keyword.getKeyword(), url);
}

} catch (Exception e) {
throw new RuntimeException("유저 알림을 저장하거나, fcm 알림을 보내는 도중 오류가 발생했습니다.", e);
}
Expand Down

0 comments on commit 5800d5e

Please sign in to comment.