API: don't return the whole user
Some checks failed
Deploy API / docker (17, 3.8.5) (push) Failing after 1m21s

This commit is contained in:
Lee 2024-08-02 01:54:50 +01:00
parent 68180f2647
commit f351c7a3c1
2 changed files with 4 additions and 2 deletions

View File

@ -2,6 +2,7 @@ package cc.fascinated.controller;
import cc.fascinated.exception.impl.BadRequestException;
import cc.fascinated.model.user.User;
import cc.fascinated.model.user.UserDTO;
import cc.fascinated.services.UserService;
import lombok.NonNull;
import org.springframework.beans.factory.annotation.Autowired;
@ -33,7 +34,7 @@ public class UserController {
*/
@ResponseBody
@GetMapping(value = "/{id}")
public ResponseEntity<User> getUser(@PathVariable String id) {
return ResponseEntity.ok(userService.getUser(id));
public ResponseEntity<UserDTO> getUser(@PathVariable String id) {
return ResponseEntity.ok(userService.getUser(id).getAsDTO());
}
}

View File

@ -73,6 +73,7 @@ public class User {
/**
* The user's statistic history.
*/
@JsonIgnore
public Map<Platform.Platforms, Map<Date, Statistic>> getStatistics() {
if (this.statistics == null) {
this.statistics = new HashMap<>();