From 0963fd937d119eaa5f8aa5174e5de3eb6c990007 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sun, 1 Jul 2018 00:09:52 +0300 Subject: Api: unread count in /me --- juick-server/src/main/java/com/juick/server/api/Users.java | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'juick-server/src/main') diff --git a/juick-server/src/main/java/com/juick/server/api/Users.java b/juick-server/src/main/java/com/juick/server/api/Users.java index 4e447d04..a7ea7ea0 100644 --- a/juick-server/src/main/java/com/juick/server/api/Users.java +++ b/juick-server/src/main/java/com/juick/server/api/Users.java @@ -20,6 +20,7 @@ package com.juick.server.api; import com.juick.User; import com.juick.server.util.HttpForbiddenException; import com.juick.server.util.HttpNotFoundException; +import com.juick.service.MessagesService; import com.juick.service.UserService; import com.juick.server.util.UserUtils; import com.juick.server.util.WebUtils; @@ -39,6 +40,8 @@ import java.util.List; public class Users { @Inject private UserService userService; + @Inject + private MessagesService messagesService; @ApiOperation(value = "This returns user token", notes = "Pass login and password using HTTP Basic") @RequestMapping(value = "/auth", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @@ -74,6 +77,7 @@ public class Users { me.setUid(visitor.getUid()); me.setName(visitor.getName()); me.setAuthHash(getAuthToken()); + me.setUnreadCount(messagesService.getUnread(visitor).size()); return me; } -- cgit v1.2.3