From 18d916391f590d2394adc18e3cff9112c977bb77 Mon Sep 17 00:00:00 2001 From: Rainnny7 Date: Mon, 16 Sep 2024 21:37:52 -0400 Subject: [PATCH] POST -> GET --- .../pulseapp/api/controller/v1/UserController.java | 7 ++----- .../java/cc/pulseapp/api/model/user/UserDTO.java | 14 +++++++------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/main/java/cc/pulseapp/api/controller/v1/UserController.java b/src/main/java/cc/pulseapp/api/controller/v1/UserController.java index 15acd4b..0697c9e 100644 --- a/src/main/java/cc/pulseapp/api/controller/v1/UserController.java +++ b/src/main/java/cc/pulseapp/api/controller/v1/UserController.java @@ -6,10 +6,7 @@ import lombok.NonNull; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; /** * This controller is responsible for @@ -36,7 +33,7 @@ public final class UserController { * * @return the currently authenticated user */ - @PostMapping("/@me") @ResponseBody @NonNull + @GetMapping("/@me") @ResponseBody @NonNull public ResponseEntity getUser() { return ResponseEntity.ok(userService.getUser()); } diff --git a/src/main/java/cc/pulseapp/api/model/user/UserDTO.java b/src/main/java/cc/pulseapp/api/model/user/UserDTO.java index 513262b..0788fc1 100644 --- a/src/main/java/cc/pulseapp/api/model/user/UserDTO.java +++ b/src/main/java/cc/pulseapp/api/model/user/UserDTO.java @@ -33,16 +33,16 @@ public final class UserDTO { */ @NonNull private final UserTier tier; - /** - * The date this user last logged in. - */ - @NonNull private final Date lastLogin; - /** * The flags for this user. */ private final int flags; + /** + * The date this user last logged in. + */ + @NonNull private final Date lastLogin; + /** * The date this user was created. */ @@ -57,8 +57,8 @@ public final class UserDTO { */ @NonNull public static UserDTO asDTO(@NonNull User user, @NonNull Date creationTime) { - return new UserDTO(user.getSnowflake(), user.getEmail(), user.getUsername(), user.getTier(), - user.getLastLogin(), user.getFlags(), creationTime + return new UserDTO(user.getSnowflake(), user.getEmail(), user.getUsername(), + user.getTier(), user.getFlags(), user.getLastLogin(), creationTime ); } } \ No newline at end of file