Games tab on admin page working

This commit is contained in:
2025-03-04 21:14:22 -05:00
parent dd4480cf4e
commit f528cbaa2b
25 changed files with 631 additions and 25 deletions

View File

@@ -0,0 +1,39 @@
package com.mattrixwv.raidbuilder.controller;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.mattrixwv.raidbuilder.annotation.AccountAuthorization;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@RestController
@RequestMapping("/icons")
public class IconController{
@Value("${uploadFileDirectory}")
private String uploadFileDirectory;
@GetMapping("/gameIcons/{gameIconName}")
@AccountAuthorization(permissions = {})
public ResponseEntity<byte[]> getGameClassIcons(@PathVariable("gameIconName") String gameIconName) throws IOException{
log.info("Getting game icon {}", gameIconName);
byte[] resource = Files.readAllBytes(Path.of(uploadFileDirectory + "/gameIcons/" + gameIconName));
return ResponseEntity.ok().body(resource);
}
}