Skip to content

Commit

Permalink
[Server] 테스트 푸시 API 수정 내용 서버 반영 (#175) (#176)
Browse files Browse the repository at this point in the history
* Chore: Redis 설정 credentials 추가

* Fix: 푸시 알림 테스트 계정 연결
  • Loading branch information
JeongHeumChoi authored Sep 29, 2024
1 parent c523452 commit 5cf343f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ public ResponseEntity<?> sendNotification(
@UserId Long userId,
@RequestBody FcmTestRequestDto fcmTestRequestDto
) {
return ResponseEntity.ok(fcmService.testNotification(fcmTestRequestDto));
return ResponseEntity.ok(fcmService.testNotification(userId, fcmTestRequestDto));
}
}
17 changes: 10 additions & 7 deletions src/main/java/Skeep/backend/fcm/service/FcmService.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,23 @@ public class FcmService {
private final UserCategoryRetriever userCategoryRetriever;
private final UserLocationRetriever userLocationRetriever;

public Void testNotification(FcmTestRequestDto fcmTestRequestDto) {
public Void testNotification(
Long userId,
FcmTestRequestDto fcmTestRequestDto
) {
String token = fcmTestRequestDto.token();
Boolean isCategory = fcmTestRequestDto.isCategory();
String typeCategory = "category";
String typeUserLocation = "userLocation";
String url;
String title;
String body;
User yusinUser = userFindService.findUserByIdAndStatus(14L);
User currentUser = userFindService.findUserByIdAndStatus(userId);

if (isCategory) {
Long id = 200L;
Long id = 594L;
UserCategory userCategory = userCategoryRetriever.findById(id);
title = yusinUser.getName() + FcmConstants.CATEGORY_TITLE_1
title = currentUser.getName() + FcmConstants.CATEGORY_TITLE_1
+ userCategory.getName() + FcmConstants.CATEGORY_TITLE_2;
body = FcmConstants.CATEGORY_BODY;
url = FcmConstants.CATEGORY_URL + userCategory.getId().toString();
Expand All @@ -60,11 +63,11 @@ public Void testNotification(FcmTestRequestDto fcmTestRequestDto) {
url
);
} else {
Long id = 65L;
Long id = 272L;
UserLocation userLocation = userLocationRetriever.findById(id);
title = yusinUser.getName() + FcmConstants.USER_LOCATION_TITLE_1
title = currentUser.getName() + FcmConstants.USER_LOCATION_TITLE_1
+ userLocation.getLocation().getPlaceName() + FcmConstants.USER_LOCATION_TITLE_2;
body = "9월 30일" + FcmConstants.USER_LOCATION_BODY;
body = "10월 8일" + FcmConstants.USER_LOCATION_BODY;
url = FcmConstants.USER_LOCATION_URL + userLocation.getId().toString();

log.info("USERLOCATION @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
Expand Down

0 comments on commit 5cf343f

Please sign in to comment.