API: show the whole user
Some checks failed
Deploy API / docker (17, 3.8.5) (push) Failing after 36s
Some checks failed
Deploy API / docker (17, 3.8.5) (push) Failing after 36s
This commit is contained in:
parent
7b1d4a73a5
commit
f68fb48726
@ -1,7 +1,7 @@
|
|||||||
package cc.fascinated.controller;
|
package cc.fascinated.controller;
|
||||||
|
|
||||||
import cc.fascinated.exception.impl.BadRequestException;
|
import cc.fascinated.exception.impl.BadRequestException;
|
||||||
import cc.fascinated.model.user.UserDTO;
|
import cc.fascinated.model.user.User;
|
||||||
import cc.fascinated.services.UserService;
|
import cc.fascinated.services.UserService;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -33,7 +33,7 @@ public class UserController {
|
|||||||
*/
|
*/
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@GetMapping(value = "/{id}")
|
@GetMapping(value = "/{id}")
|
||||||
public ResponseEntity<UserDTO> getUser(@PathVariable String id) {
|
public ResponseEntity<User> getUser(@PathVariable String id) {
|
||||||
return ResponseEntity.ok(userService.getUser(id).getAsDTO());
|
return ResponseEntity.ok(userService.getUser(id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package cc.fascinated.model.score;
|
|||||||
|
|
||||||
import cc.fascinated.model.leaderboard.Leaderboard;
|
import cc.fascinated.model.leaderboard.Leaderboard;
|
||||||
import cc.fascinated.model.user.ScoreSaberAccount;
|
import cc.fascinated.model.user.ScoreSaberAccount;
|
||||||
|
import cc.fascinated.model.user.User;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
@ -74,9 +75,9 @@ public class ScoreResponse {
|
|||||||
private Double accuracy;
|
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.
|
* The ID of the leaderboard.
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package cc.fascinated.model.user;
|
package cc.fascinated.model.user;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
@ -47,19 +48,11 @@ public class User {
|
|||||||
* If they haven't logged in, we don't want to track their profiles.
|
* If they haven't logged in, we don't want to track their profiles.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
|
@JsonIgnore
|
||||||
public boolean hasLoggedIn;
|
public boolean hasLoggedIn;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The user's ScoreSaber account token.
|
* The user's ScoreSaber account.
|
||||||
*/
|
*/
|
||||||
public ScoreSaberAccount scoresaberAccount;
|
public ScoreSaberAccount scoresaberAccount;
|
||||||
|
|
||||||
/**
|
|
||||||
* Converts the User object to a UserDTO object.
|
|
||||||
*
|
|
||||||
* @return The UserDTO object.
|
|
||||||
*/
|
|
||||||
public UserDTO getAsDTO() {
|
|
||||||
return new UserDTO(id, username, steamId);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -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.
|
|
||||||
* <p>
|
|
||||||
* Usually their Steam name.
|
|
||||||
* </p>
|
|
||||||
*/
|
|
||||||
private String username;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The ID of the users steam profile.
|
|
||||||
*/
|
|
||||||
private String steamId;
|
|
||||||
}
|
|
@ -89,7 +89,7 @@ public class TrackedScoreService {
|
|||||||
trackedScore.getBadCuts(),
|
trackedScore.getBadCuts(),
|
||||||
trackedScore.getMaxCombo(),
|
trackedScore.getMaxCombo(),
|
||||||
trackedScore.getAccuracy(),
|
trackedScore.getAccuracy(),
|
||||||
user.getScoresaberAccount(),
|
user,
|
||||||
leaderboard,
|
leaderboard,
|
||||||
trackedScore.getTimestamp()
|
trackedScore.getTimestamp()
|
||||||
));
|
));
|
||||||
|
Reference in New Issue
Block a user