-
Notifications
You must be signed in to change notification settings - Fork 0
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 #142 from UMC5th-bias/develop
[DEPLOY] main <- develop 배포
- Loading branch information
Showing
35 changed files
with
1,062 additions
and
68 deletions.
There are no files selected for viewing
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
42 changes: 42 additions & 0 deletions
42
src/main/java/com/favoriteplace/app/controller/FCMNotificationController.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,42 @@ | ||
package com.favoriteplace.app.controller; | ||
|
||
import com.favoriteplace.app.service.fcm.FCMNotificationService; | ||
import com.favoriteplace.app.service.fcm.dto.PostTokenCond; | ||
import com.favoriteplace.app.service.fcm.enums.TokenMessage; | ||
import com.favoriteplace.app.service.fcm.enums.TotalTopicMessage; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequestMapping("/fcm") | ||
@RequiredArgsConstructor | ||
public class FCMNotificationController { | ||
private final FCMNotificationService fcmNotificationService; | ||
|
||
@PostMapping("/token") | ||
public String sendNotificationByToken( | ||
@RequestParam String token | ||
){ | ||
return fcmNotificationService.sendNotificationByToken(PostTokenCond.builder() | ||
.token(token).postId(1L).tokenMessage(TokenMessage.POST_NEW_COMMENT).message("댓글 내용") | ||
.build()); | ||
} | ||
|
||
@PostMapping("/topic/subscribe") | ||
public String subScribeTopic( | ||
@RequestParam String token | ||
){ | ||
fcmNotificationService.subscribeTopic("total", token); | ||
return "토픽에 정상적으로 등록 완료"; | ||
} | ||
|
||
@PostMapping("/topic/send") | ||
public String sendAlarmByTopic( | ||
|
||
){ | ||
return fcmNotificationService.sendTotalAlarmByTopic(TotalTopicMessage.INFORM); | ||
} | ||
} |
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
60 changes: 60 additions & 0 deletions
60
src/main/java/com/favoriteplace/app/controller/NotificationController.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,60 @@ | ||
package com.favoriteplace.app.controller; | ||
|
||
import com.favoriteplace.app.domain.Member; | ||
import com.favoriteplace.app.dto.NotificationResponseDto; | ||
import com.favoriteplace.app.service.NotificationService; | ||
import com.favoriteplace.global.util.SecurityUtil; | ||
import jakarta.validation.constraints.Min; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.validation.annotation.Validated; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
@RestController | ||
@RequestMapping("/notifications") | ||
@RequiredArgsConstructor | ||
@Validated | ||
public class NotificationController { | ||
private final NotificationService notificationService; | ||
private final SecurityUtil securityUtil; | ||
|
||
// 알림 전체 조회 | ||
@GetMapping() | ||
public ResponseEntity<NotificationResponseDto> getAllNotification( | ||
@Min(value = 1, message = "page는 1 이상입니다.") @RequestParam(required = false, defaultValue = "1") Integer page, | ||
@Min(value = 1, message = "size는 1 이상입니다.") @RequestParam(required = false, defaultValue = "1") Integer size | ||
){ | ||
Member member = securityUtil.getUser(); | ||
NotificationResponseDto response = notificationService.getAllNotification(member, page, size); | ||
return ResponseEntity.ok(response); | ||
} | ||
|
||
// 알림 한번에 다 읽음 처리 | ||
@PatchMapping() | ||
public ResponseEntity<?> readAllNotification(){ | ||
Member member = securityUtil.getUser(); | ||
notificationService.readAllNotification(member); | ||
return ResponseEntity.noContent().build(); | ||
} | ||
|
||
// 특정 알림 읽음 처리 | ||
@PatchMapping("/{notificationId}") | ||
public ResponseEntity<?> readNotification( | ||
@PathVariable Long notificationId | ||
){ | ||
Member member = securityUtil.getUser(); | ||
notificationService.readNotification(notificationId, member); | ||
return ResponseEntity.noContent().build(); | ||
} | ||
|
||
// 특정 알림 삭제 | ||
@DeleteMapping("/{notificationId}") | ||
public ResponseEntity<?> deleteNotification( | ||
@PathVariable Long notificationId | ||
){ | ||
Member member = securityUtil.getUser(); | ||
notificationService.deleteNotification(notificationId, member); | ||
return ResponseEntity.noContent().build(); | ||
} | ||
|
||
} |
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
Oops, something went wrong.