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

@ -2,6 +2,7 @@ package cc.fascinated.controller;
import cc.fascinated.exception.impl.BadRequestException; import cc.fascinated.exception.impl.BadRequestException;
import cc.fascinated.model.user.User; import cc.fascinated.model.user.User;
import cc.fascinated.model.user.UserDTO;
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 +34,7 @@ public class UserController {
*/ */
@ResponseBody @ResponseBody
@GetMapping(value = "/{id}") @GetMapping(value = "/{id}")
public ResponseEntity<User> getUser(@PathVariable String id) { public ResponseEntity<UserDTO> getUser(@PathVariable String id) {
return ResponseEntity.ok(userService.getUser(id)); return ResponseEntity.ok(userService.getUser(id).getAsDTO());
} }
} }

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