-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] admin api for retrying dead letter
- Loading branch information
Showing
7 changed files
with
80 additions
and
1 deletion.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
...src/main/java/com/twtw/backend/domain/notification/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,30 @@ | ||
package com.twtw.backend.domain.notification.controller; | ||
|
||
import com.twtw.backend.domain.notification.messagequeue.FcmProducer; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
|
||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.security.access.prepost.PreAuthorize; | ||
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; | ||
|
||
import java.util.List; | ||
import java.util.UUID; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("notifications") | ||
public class NotificationController { | ||
|
||
private final FcmProducer fcmProducer; | ||
|
||
@PreAuthorize("hasRole('ADMIN')") | ||
@PostMapping | ||
public ResponseEntity<Void> sendNotification(@RequestBody final List<UUID> ids) { | ||
fcmProducer.sendFailedNotification(ids); | ||
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
19 changes: 19 additions & 0 deletions
19
backend/src/main/java/com/twtw/backend/domain/notification/mapper/NotificationMapper.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,19 @@ | ||
package com.twtw.backend.domain.notification.mapper; | ||
|
||
import com.twtw.backend.domain.notification.dto.NotificationRequest; | ||
import com.twtw.backend.domain.notification.entity.Notification; | ||
|
||
import org.mapstruct.Mapper; | ||
import org.mapstruct.Mapping; | ||
import org.mapstruct.MappingConstants.ComponentModel; | ||
|
||
@Mapper(componentModel = ComponentModel.SPRING) | ||
public interface NotificationMapper { | ||
|
||
@Mapping(target = "notificationId", source = "notification.id") | ||
@Mapping(target = "deviceToken", source = "notification.notificationType") | ||
@Mapping(target = "title", source = "notification.title") | ||
@Mapping(target = "body", source = "notification.body") | ||
@Mapping(target = "id", source = "notification.idInfo") | ||
NotificationRequest toNotificationRequest(final Notification notification); | ||
} |
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