Skip to content

Commit

Permalink
🔨 코드리뷰 반영
Browse files Browse the repository at this point in the history
  • Loading branch information
CYY1007 committed Jan 24, 2024
1 parent 6a43216 commit 8b4b1a3
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ public List<Briefing> findBriefings(BriefingRequestParam.BriefingPreviewListPara
briefingRepository.findAllByTypeAndCreatedAtBetweenOrderByRanks(
params.getType(), startDateTime, endDateTime);
if (briefingList.isEmpty()) {
briefingList = null;
briefingRepository.findTop10ByTypeOrderByCreatedAtDesc(BriefingType.SOCIAL);
briefingList = briefingRepository.findTop10ByTypeOrderByCreatedAtDesc(BriefingType.SOCIAL);
}
return briefingList;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,38 @@

import com.example.briefingapi.fcm.implementation.FcmCommandService;
import com.example.briefingapi.fcm.presentation.dto.FcmRequest;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "06-Push-alarm 🚀", description = "푸쉬 알림 관련 API")
@RestController
@RequiredArgsConstructor
@RequestMapping("/fcms")
@RequestMapping("/pushs")
public class FcmApi {

private final FcmCommandService fcmCommandService;

@Operation(summary = "06-02 🚀[테스트] FCM 구독 테스트용 API")
@PostMapping("/subscribe")
public String testFcmSubscribe(@RequestBody FcmRequest.FcmTokenDTO body){
fcmCommandService.subScribe("dailyPush",body.getToken());
return "response";
}

@Operation(summary = "06-03 🚀[테스트] FCM 구독 취소 테스트용 API")
@PostMapping("/unsubscribe")
public String testFcmUnSubscribe(@RequestBody FcmRequest.FcmTokenDTO body){
fcmCommandService.unSubScribe("dailyPush",body.getToken());
return "response";
}

@PostMapping("/send")
@Operation(summary = "06-01 🚀[테스트] FCM 전송 테스트용 API")
@PostMapping("/")
public String testSendMessage(){
fcmCommandService.sendMessage("dailyPush");
return "response";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ public class MemberFacade {
@Value("${fcm.topic.daily-push}")
private String dailyPushTopic;

@Value(("${fcm.permit-flag}"))
private Integer permitFlag;

private Member loginWithGoogle(String identityToken) {
GoogleUserInfo googleUserInfo = googleOauth2Client.verifyToken(identityToken);
Member member =
Expand Down Expand Up @@ -103,7 +106,7 @@ public MemberResponse.QuitDTO quit(final Long memberId) {

public void subScribeDailyPush(MemberRequest.ToggleDailyPushAlarmDTO request, Member member){

if(request.getPermit().equals(1)){
if(request.getPermit().equals(permitFlag)){
memberCommandService.storeFcmToken(request.getFcmToken(),member);
fcmCommandService.subScribe(dailyPushTopic, request.getFcmToken());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class MemberApi {
private final MemberFacade memberFacade;


@Operation(summary = "Member\uD83D\uDC64 테스트를 위한 토큰 발급 API", description = "테스트 용")
@Operation(summary = "02-05 Member\uD83D\uDC64 [테스트] 테스트를 위한 토큰 발급 API", description = "테스트 용")
@GetMapping("/members/auth/test")
public CommonResponse<MemberResponse.TestTokenDTO> testGenerateToken() {
return CommonResponse.onSuccess(memberFacade.getTestToken());
Expand Down
1 change: 1 addition & 0 deletions Briefing-Api/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ swagger:
password : ${SWAGGER_PASS}
fcm:
key: ${FCM_KEY}
permit-flag : 1
topic:
daily-push : dailyPush
---
Expand Down

0 comments on commit 8b4b1a3

Please sign in to comment.