-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #87 from Donut-DONationUTile/feature/fcm
Feature/fcm
- Loading branch information
Showing
6 changed files
with
114 additions
and
30 deletions.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
src/main/java/zero/eight/donut/controller/FcmController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package zero.eight.donut.controller; | ||
|
||
import com.google.firebase.messaging.FirebaseMessagingException; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.web.bind.annotation.*; | ||
import zero.eight.donut.common.response.ApiResponse; | ||
import zero.eight.donut.dto.fcm.FcmTokenRequestDto; | ||
import zero.eight.donut.exception.Success; | ||
import zero.eight.donut.service.DonationService; | ||
import zero.eight.donut.service.FcmService; | ||
|
||
@RequiredArgsConstructor | ||
@RequestMapping("/api/fcm") | ||
@RestController | ||
public class FcmController { | ||
|
||
private final FcmService fcmService; | ||
private final DonationService donationService; | ||
|
||
@PostMapping("/token") | ||
public ApiResponse<?> createFcmToken(@RequestBody FcmTokenRequestDto requestDto) throws Exception { | ||
return fcmService.registerFcmToken(requestDto); | ||
} | ||
|
||
@PostMapping("/test/37") | ||
public ApiResponse<?> test37() throws FirebaseMessagingException { | ||
return ApiResponse.success(Success.FCM_TEST_SUCCESS, fcmService.imminentWallet()); | ||
} | ||
|
||
@PostMapping("/test/7") | ||
public ApiResponse<?> test7() throws FirebaseMessagingException { | ||
return ApiResponse.success(Success.FCM_TEST_SUCCESS, fcmService.immminentGift()); | ||
} | ||
|
||
@PostMapping("/test/30") | ||
public ApiResponse<?> test30() throws FirebaseMessagingException { | ||
return ApiResponse.success(Success.FCM_TEST_SUCCESS, donationService.autoDonate()); | ||
} | ||
|
||
@GetMapping("/mock/37/{email}") | ||
public ApiResponse<?> mock37(@PathVariable("email") String email, @RequestParam("product") String product) throws FirebaseMessagingException { | ||
return ApiResponse.success(Success.FCM_TEST_SUCCESS, fcmService.mock37(email, product)); | ||
} | ||
|
||
@GetMapping("/mock/30/{email}") | ||
public ApiResponse<?> mock30(@PathVariable("email") String email, @RequestParam("product") String product) throws FirebaseMessagingException { | ||
return ApiResponse.success(Success.FCM_TEST_SUCCESS, fcmService.mock30(email, product)); | ||
} | ||
|
||
@GetMapping("/mock/7/{email}") | ||
public ApiResponse<?> mock7(@PathVariable("email") String email, @RequestParam("product") String product) throws FirebaseMessagingException { | ||
return ApiResponse.success(Success.FCM_TEST_SUCCESS, fcmService.mock30(email, product)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters