Browse Source

report hype v3

master
gsd 10 months ago
parent
commit
558a033723
  1. 18
      src/main/java/app/controllers/server/ServerUpdaterController.java

18
src/main/java/app/controllers/server/ServerUpdaterController.java

@ -9,11 +9,14 @@ import app.services.ProfileService;
import app.services.db.ReportService; import app.services.db.ReportService;
import app.websocket.handlers.ServersHandler; import app.websocket.handlers.ServersHandler;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.Map;
@RestController @RestController
@RequestMapping("api/server") @RequestMapping("api/server")
public class ServerUpdaterController { public class ServerUpdaterController {
@ -51,13 +54,18 @@ public class ServerUpdaterController {
return new ResponseEntity(HttpStatus.OK); return new ResponseEntity(HttpStatus.OK);
} }
@PostMapping(value = "/{srv}/report/{author_steam64}/{reported_steam64}") @PostMapping(value = "/{srv}/report")
@CheckWebAccess(auth_method = AuthMethod.SECRET_KEY) @CheckWebAccess(auth_method = AuthMethod.SECRET_KEY)
public ResponseEntity sendReport(HttpServletRequest request, public ResponseEntity sendReport(HttpServletRequest request,
@PathVariable(required = true) String author_steam64, @RequestBody ReportBody body, @PathVariable String srv) {
@PathVariable(required = false) String reported_steam64,
@RequestBody String text, @PathVariable String srv) {
return ResponseEntity.status(HttpStatus.OK).body( 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;
} }
} }

Loading…
Cancel
Save