Skip to content

Commit

Permalink
style: 메서드명 및 줄바꿈 설정
Browse files Browse the repository at this point in the history
  • Loading branch information
hongdosan committed Nov 2, 2023
1 parent 0be59d9 commit bddf87a
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ public class NotificationService {
public void sendKnockNotification(MemberTest member, Long targetId) {
validateFcmToken(targetId);
validateKnockNotification(member.memberId(), targetId);

String fcmToken = notificationRepository.findFcmTokenByMemberId(targetId);
Notification notification = NotificationMapper.toKnockNotificationEntity(member.memberId());
Message message = NotificationMapper.toMessageEntity(notification, fcmToken);

firebaseMessaging.sendAsync(message);
notificationRepository.saveKnockNotification(member.memberId(), targetId);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.moabam.api.domain.repository;

import static com.moabam.global.common.util.GlobalConstant.*;
import static java.util.Objects.*;

import java.time.Duration;
Expand All @@ -17,6 +18,7 @@ public class NotificationRepository {
private static final long EXPIRE_KNOCK = 20;
private static final long EXPIRE_FCM_TOKEN = 60;
private static final String TO = "_TO_";

private final StringRedisRepository stringRedisRepository;

// TODO : 세연님 로그인 시, 해당 메서드 사용해서 해당 유저의 FCM TOKEN 저장하면 됩니다.
Expand All @@ -31,7 +33,7 @@ public void saveFcmToken(Long key, String value) {
public void saveKnockNotification(Long memberId, Long targetId) {
stringRedisRepository.save(
requireNonNull(memberId) + TO + requireNonNull(targetId),
"",
BLANK,
requireNonNull(Duration.ofMinutes(EXPIRE_KNOCK))
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class GlobalConstant {

public static final String BLANK = "";
public static final String COMMA = ",";
public static final String CHARSET_UTF_8 = ";charset=UTF-8";
}
2 changes: 1 addition & 1 deletion src/main/java/com/moabam/global/config/FcmConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public FirebaseMessaging firebaseMessaging() {

return FirebaseMessaging.getInstance();
} catch (IOException e) {
log.error("====== firebase moabam error : " + e);
log.error("======= firebase moabam error =======" + e + "");
throw new FcmException(ErrorMessage.FCM_INIT_FAILED);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ protected ErrorResponse handleBadRequestException(MoabamException moabamExceptio

@ResponseStatus(HttpStatus.BAD_REQUEST)
@ExceptionHandler(FcmException.class)
protected ErrorResponse handleFirebaseException(MoabamException moabamException) {
protected ErrorResponse handleFcmException(MoabamException moabamException) {
return new ErrorResponse(moabamException.getMessage(), null);
}

@ResponseStatus(HttpStatus.BAD_REQUEST)
@ExceptionHandler(NullPointerException.class)
protected ErrorResponse handleFirebaseException(NullPointerException exception) {
protected ErrorResponse handleNullPointerException(NullPointerException exception) {
return new ErrorResponse(exception.getMessage(), null);
}

Expand Down

0 comments on commit bddf87a

Please sign in to comment.