aboutsummaryrefslogtreecommitdiff
path: root/juick-api/src/main/java/com/juick
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2017-09-22 17:13:15 +0300
committerGravatar Vitaly Takmazov2017-09-22 17:13:15 +0300
commit0761ac90a89cf826e100ec7cea660b38288fab9b (patch)
tree67bf7d311333d9186975f163088c7b2412c533ff /juick-api/src/main/java/com/juick
parent0bbc16c2fd3940a41b96804ef6520be9c19baacd (diff)
api: /messages/notifications
Diffstat (limited to 'juick-api/src/main/java/com/juick')
-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) {