aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/main/java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-08-27 12:20:16 +0300
committerGravatar Vitaly Takmazov2018-08-27 12:20:16 +0300
commitdfe75bb13736cb477cae97a5d336f6601a11113d (patch)
treed9008f1fc0de2d617c80d18a458a30289e09c1c9 /juick-server/src/main/java
parent926bdf95c75ac8f4abbc403b0a2c24327e405903 (diff)
/info/{uname} API
Diffstat (limited to 'juick-server/src/main/java')
-rw-r--r--juick-server/src/main/java/com/juick/server/api/Users.java11
1 files changed, 11 insertions, 0 deletions
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 41deddb8..1258e43c 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,6 +18,7 @@
package com.juick.server.api;
import com.juick.User;
+import com.juick.server.helpers.UserInfo;
import com.juick.server.util.HttpForbiddenException;
import com.juick.server.util.HttpNotFoundException;
import com.juick.service.MessagesService;
@@ -135,6 +136,16 @@ public class Users {
throw new HttpNotFoundException();
}
+ @ApiOperation(value = "This returns detailed user info")
+ @GetMapping("/info/{uname}")
+ public UserInfo getUserInfo(@PathVariable String uname) {
+ User user = userService.getUserByName(uname);
+ if (!user.isBanned()) {
+ return userService.getUserInfo(user);
+ }
+ throw new HttpNotFoundException();
+ }
+
class SecureUser extends User {
public String getHash() {
return getAuthHash();