diff --git a/src/main/java/app/controllers/server/ServerUpdaterController.java b/src/main/java/app/controllers/server/ServerUpdaterController.java index 54f3ae2..93f8779 100644 --- a/src/main/java/app/controllers/server/ServerUpdaterController.java +++ b/src/main/java/app/controllers/server/ServerUpdaterController.java @@ -9,11 +9,14 @@ import app.services.ProfileService; import app.services.db.ReportService; import app.websocket.handlers.ServersHandler; import jakarta.servlet.http.HttpServletRequest; +import lombok.Data; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; +import java.util.Map; + @RestController @RequestMapping("api/server") public class ServerUpdaterController { @@ -51,13 +54,18 @@ public class ServerUpdaterController { return new ResponseEntity(HttpStatus.OK); } - @PostMapping(value = "/{srv}/report/{author_steam64}/{reported_steam64}") + @PostMapping(value = "/{srv}/report") @CheckWebAccess(auth_method = AuthMethod.SECRET_KEY) public ResponseEntity sendReport(HttpServletRequest request, - @PathVariable(required = true) String author_steam64, - @PathVariable(required = false) String reported_steam64, - @RequestBody String text, @PathVariable String srv) { + @RequestBody ReportBody body, @PathVariable String srv) { return ResponseEntity.status(HttpStatus.OK).body( - reportService.createReport(ReportType.IN_GAME, profileService.GetProfile(author_steam64, "permition,steam_data"), profileService.GetProfile(reported_steam64, "permition"), text)); + reportService.createReport(ReportType.IN_GAME, profileService.GetProfile(body.getAuthor_steam64(), "permition,steam_data"), profileService.GetProfile(body.getReported_steam64(), "permition"), body.getReason())); + } + + @Data + public class ReportBody { + private String author_steam64; + private String reported_steam64; + private String reason; } }