diff --git a/API/src/main/java/cc/fascinated/controller/UserController.java b/API/src/main/java/cc/fascinated/controller/UserController.java index 53e8ce6..9fbf861 100644 --- a/API/src/main/java/cc/fascinated/controller/UserController.java +++ b/API/src/main/java/cc/fascinated/controller/UserController.java @@ -1,7 +1,7 @@ package cc.fascinated.controller; import cc.fascinated.exception.impl.BadRequestException; -import cc.fascinated.model.user.UserDTO; +import cc.fascinated.model.user.User; import cc.fascinated.services.UserService; import lombok.NonNull; import org.springframework.beans.factory.annotation.Autowired; @@ -33,7 +33,7 @@ public class UserController { */ @ResponseBody @GetMapping(value = "/{id}") - public ResponseEntity getUser(@PathVariable String id) { - return ResponseEntity.ok(userService.getUser(id).getAsDTO()); + public ResponseEntity getUser(@PathVariable String id) { + return ResponseEntity.ok(userService.getUser(id)); } } diff --git a/API/src/main/java/cc/fascinated/model/score/ScoreResponse.java b/API/src/main/java/cc/fascinated/model/score/ScoreResponse.java index 083c895..774711e 100644 --- a/API/src/main/java/cc/fascinated/model/score/ScoreResponse.java +++ b/API/src/main/java/cc/fascinated/model/score/ScoreResponse.java @@ -2,6 +2,7 @@ package cc.fascinated.model.score; import cc.fascinated.model.leaderboard.Leaderboard; import cc.fascinated.model.user.ScoreSaberAccount; +import cc.fascinated.model.user.User; import lombok.AllArgsConstructor; import lombok.Getter; @@ -74,9 +75,9 @@ public class ScoreResponse { private Double accuracy; /** - * The ID of the player who set the score. + * The user who set the score. */ - private ScoreSaberAccount player; + private User user; /** * The ID of the leaderboard. diff --git a/API/src/main/java/cc/fascinated/model/user/User.java b/API/src/main/java/cc/fascinated/model/user/User.java index 6cdda06..f67af17 100644 --- a/API/src/main/java/cc/fascinated/model/user/User.java +++ b/API/src/main/java/cc/fascinated/model/user/User.java @@ -1,5 +1,6 @@ package cc.fascinated.model.user; +import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Getter; import lombok.RequiredArgsConstructor; import lombok.Setter; @@ -47,19 +48,11 @@ public class User { * If they haven't logged in, we don't want to track their profiles. *

*/ + @JsonIgnore public boolean hasLoggedIn; /** - * The user's ScoreSaber account token. + * The user's ScoreSaber account. */ public ScoreSaberAccount scoresaberAccount; - - /** - * Converts the User object to a UserDTO object. - * - * @return The UserDTO object. - */ - public UserDTO getAsDTO() { - return new UserDTO(id, username, steamId); - } } diff --git a/API/src/main/java/cc/fascinated/model/user/UserDTO.java b/API/src/main/java/cc/fascinated/model/user/UserDTO.java deleted file mode 100644 index 55dc862..0000000 --- a/API/src/main/java/cc/fascinated/model/user/UserDTO.java +++ /dev/null @@ -1,33 +0,0 @@ -package cc.fascinated.model.user; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import org.springframework.data.annotation.Id; - -import java.util.UUID; - -/** - * @author Fascinated (fascinated7) - */ -@AllArgsConstructor -@Getter -public class UserDTO { - /** - * The ID of the user. - */ - @Id - private final UUID id; - - /** - * The username of the user. - *

- * Usually their Steam name. - *

- */ - private String username; - - /** - * The ID of the users steam profile. - */ - private String steamId; -} diff --git a/API/src/main/java/cc/fascinated/services/TrackedScoreService.java b/API/src/main/java/cc/fascinated/services/TrackedScoreService.java index 099db0a..e52330c 100644 --- a/API/src/main/java/cc/fascinated/services/TrackedScoreService.java +++ b/API/src/main/java/cc/fascinated/services/TrackedScoreService.java @@ -89,7 +89,7 @@ public class TrackedScoreService { trackedScore.getBadCuts(), trackedScore.getMaxCombo(), trackedScore.getAccuracy(), - user.getScoresaberAccount(), + user, leaderboard, trackedScore.getTimestamp() ));