aboutsummaryrefslogtreecommitdiff
path: root/juick-api/src/main/java/com/juick/api
diff options
context:
space:
mode:
Diffstat (limited to 'juick-api/src/main/java/com/juick/api')
-rw-r--r--juick-api/src/main/java/com/juick/api/controllers/Messages.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/juick-api/src/main/java/com/juick/api/controllers/Messages.java b/juick-api/src/main/java/com/juick/api/controllers/Messages.java
index bc324996..3037f3a1 100644
--- a/juick-api/src/main/java/com/juick/api/controllers/Messages.java
+++ b/juick-api/src/main/java/com/juick/api/controllers/Messages.java
@@ -34,6 +34,9 @@ import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.inject.Inject;
+import java.time.Instant;
+import java.time.LocalDateTime;
+import java.time.ZoneId;
import java.util.Collections;
import java.util.List;
@@ -131,6 +134,13 @@ public class Messages {
return ResponseEntity.ok(messagesService.getMessages(mids));
}
+ @GetMapping("/messages/notifications")
+ public ResponseEntity<List<com.juick.Message>> getNotifications(
+ @RequestParam(required = false) Long before
+ ) {
+ User visitor = UserUtils.getCurrentUser();
+ return ResponseEntity.ok(messagesService.getNotifications(visitor, LocalDateTime.ofInstant(Instant.ofEpochMilli(before), ZoneId.systemDefault())));
+ }
@RequestMapping("/thread")
public ResponseEntity<List<com.juick.Message>> getThread(
@RequestParam(defaultValue = "0") int mid) {