|
|
@ -3,6 +3,8 @@ package app.controllers.discord; |
|
|
import app.annotations.enums.AuthMethod; |
|
|
import app.annotations.enums.AuthMethod; |
|
|
import app.annotations.interfaces.CheckWebAccess; |
|
|
import app.annotations.interfaces.CheckWebAccess; |
|
|
import app.entities.other.SteamID; |
|
|
import app.entities.other.SteamID; |
|
|
|
|
|
import app.entities.report.Report; |
|
|
|
|
|
import app.repositories.ReportRepository; |
|
|
import app.services.db.DiscordAuthService; |
|
|
import app.services.db.DiscordAuthService; |
|
|
import app.utils.SteamIDConverter; |
|
|
import app.utils.SteamIDConverter; |
|
|
import jakarta.servlet.http.HttpServletRequest; |
|
|
import jakarta.servlet.http.HttpServletRequest; |
|
|
@ -23,6 +25,9 @@ import java.util.UUID; |
|
|
public class DiscordController { |
|
|
public class DiscordController { |
|
|
DiscordAuthService discordAuthService; |
|
|
DiscordAuthService discordAuthService; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private ReportRepository reportRepository; |
|
|
|
|
|
|
|
|
@Autowired |
|
|
@Autowired |
|
|
public DiscordController(DiscordAuthService discordAuthService) { |
|
|
public DiscordController(DiscordAuthService discordAuthService) { |
|
|
this.discordAuthService = discordAuthService; |
|
|
this.discordAuthService = discordAuthService; |
|
|
@ -91,4 +96,17 @@ public class DiscordController { |
|
|
return new ResponseEntity(discordAuthService.getAccountsNotInList(discord_accounts), HttpStatus.OK); |
|
|
return new ResponseEntity(discordAuthService.getAccountsNotInList(discord_accounts), HttpStatus.OK); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/report/s") |
|
|
|
|
|
@CheckWebAccess(auth_method = AuthMethod.SECRET_KEY) |
|
|
|
|
|
public ResponseEntity<List<Report>> getAllReports(HttpServletRequest request) { |
|
|
|
|
|
return new ResponseEntity<>(reportRepository.getAll(), HttpStatus.OK); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/report/:id") |
|
|
|
|
|
@CheckWebAccess(auth_method = AuthMethod.SECRET_KEY) |
|
|
|
|
|
public ResponseEntity<Report> getReportById(HttpServletRequest request, |
|
|
|
|
|
Long id) { |
|
|
|
|
|
return new ResponseEntity<>(reportRepository.getReportById(id), HttpStatus.OK); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|