Skip to content

Commit

Permalink
Merge pull request #134 from Hanaro-trip-together-bank/feature/dues_paid
Browse files Browse the repository at this point in the history
Feature/dues paid
  • Loading branch information
ny2060 authored Jun 5, 2024
2 parents a7f0d2f + 2aaa30a commit 26ce878
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
import com.google.auth.oauth2.GoogleCredentials;
import com.google.firebase.FirebaseApp;
import com.google.firebase.FirebaseOptions;
import com.google.firebase.messaging.BatchResponse;
import com.google.firebase.messaging.FirebaseMessaging;
import com.google.firebase.messaging.FirebaseMessagingException;
import com.google.firebase.messaging.MulticastMessage;
import com.google.firebase.messaging.*;
import com.hanaro.triptogether.common.response.BaseResponse;
import com.hanaro.triptogether.common.response.ResponseStatus;
import com.hanaro.triptogether.dues.dto.request.DuesAlarmRequestDto;
Expand Down Expand Up @@ -76,6 +73,7 @@ public void sendMessageTo(FcmSendDto fcmSendDto) throws IOException {
private String makeMessage(FcmSendDto fcmSendDto) throws JsonProcessingException {

ObjectMapper om = new ObjectMapper();

FcmMessageDto fcmMessageDto = FcmMessageDto
.builder()
.message(FcmMessageDto.Message.builder()
Expand Down Expand Up @@ -135,9 +133,10 @@ public BaseResponse notificationAlarm(String title, String body, DuesAlarmReques
}

MulticastMessage message = MulticastMessage.builder()
.putData("fcm_type","NOTIFICATION")
.putData("title",title)
.putData("body",body)
.setNotification(Notification.builder()
.setTitle(title)
.setBody("회비 "+body+" 원을 요청하였습니다.")
.build())
.addAllTokens(tokenList)
.build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
import com.hanaro.triptogether.exchangeRate.utils.ExchangeUtils;
import com.hanaro.triptogether.member.domain.Member;
import com.hanaro.triptogether.member.domain.MemberRepository;
import com.hanaro.triptogether.team.domain.Team;
import com.hanaro.triptogether.team.domain.TeamRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
Expand All @@ -34,12 +32,11 @@
public class ExchangeService {

private final ExchangeRateAlarmRepository exchangeRateAlarmRepository;
private final TeamRepository teamRepository;
private final MemberRepository memberRepository;
private final ExchangeRateRepository exchangeRateRepository;

private final ExchangeUtils exchangeUtils;
private FirebaseFCMService firebaseFCMService;
private final FirebaseFCMService firebaseFCMService;

public ExchangeRateInfoResponseDto getExchangeRate(){

Expand Down Expand Up @@ -94,7 +91,7 @@ public void checkNotifyAlarms() throws IOException {
}

if (notify) {
firebaseFCMService.sendMessageTo(FcmSendDto.builder().token(alarm.getFcmToken()).title("환율 알림").body("설정한 환율 조건에 도달했습니다.").build());
firebaseFCMService.sendMessageTo(FcmSendDto.builder().token(alarm.getFcmToken()).title("환율 알림").body("환율이 "+alarm.getCurRate()+" 에 도달했어요~!!.").build());
alarm.setNotified(true);
exchangeRateAlarmRepository.save(alarm);

Expand Down

This file was deleted.

0 comments on commit 26ce878

Please sign in to comment.