From 24dc0eb58bb37f7989a0e334a50f7bfe689f1e03 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 27 Aug 2018 14:03:32 +0300 Subject: add more data to /me endpoint --- .../src/main/java/com/juick/server/api/Users.java | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'juick-server') 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 1258e43c..c91581a0 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 @@ -18,9 +18,12 @@ package com.juick.server.api; import com.juick.User; +import com.juick.server.helpers.ApplicationStatus; import com.juick.server.helpers.UserInfo; import com.juick.server.util.HttpForbiddenException; import com.juick.server.util.HttpNotFoundException; +import com.juick.service.CrosspostService; +import com.juick.service.EmailService; import com.juick.service.MessagesService; import com.juick.service.UserService; import com.juick.server.util.UserUtils; @@ -43,6 +46,10 @@ public class Users { private UserService userService; @Inject private MessagesService messagesService; + @Inject + private CrosspostService crosspostService; + @Inject + private EmailService emailService; @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) @@ -150,5 +157,26 @@ public class Users { public String getHash() { return getAuthHash(); } + public UserInfo getUserInfo() { + return userService.getUserInfo(this); + } + public List getJIDs() { + return userService.getAllJIDs(this); + } + public List getEmails() { + return userService.getEmails(this); + } + public String getActiveEmail() { + return emailService.getNotificationsEmail(this.getUid()); + } + public String getTwitterName() { + return crosspostService.getTwitterName(this.getUid()); + } + public String getTelegramName() { + return crosspostService.getTelegramName(this.getUid()); + } + public ApplicationStatus getFacebookStatus() { + return crosspostService.getFbCrossPostStatus(this.getUid()); + } } } -- cgit v1.2.3