From 7bd25136abfe81acc8d461c1f3635b0308a7ccbe Mon Sep 17 00:00:00 2001 From: "david.alvarez" Date: Tue, 9 Jun 2026 14:17:27 +0200 Subject: [PATCH] more style --- src/main/java/com/dostalgia/GameService.java | 10 ++++------ src/main/java/com/dostalgia/GameStore.java | 2 +- src/main/java/com/dostalgia/IgdbController.java | 9 +++++---- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/dostalgia/GameService.java b/src/main/java/com/dostalgia/GameService.java index 5fa1005..fdf9635 100644 --- a/src/main/java/com/dostalgia/GameService.java +++ b/src/main/java/com/dostalgia/GameService.java @@ -20,15 +20,14 @@ import java.nio.file.SimpleFileVisitor; import java.nio.file.StandardCopyOption; import java.nio.file.attribute.BasicFileAttributes; import java.time.Instant; -import java.util.*; -import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; /** Manages game metadata stored as JSON files on disk. */ @ApplicationScoped public class GameService implements GameStore { - private static final Logger LOG = Logger.getLogger(GameService.class.getName()); - private final ObjectMapper mapper = new ObjectMapper() .registerModule(new JavaTimeModule()) .setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE) @@ -121,7 +120,7 @@ public class GameService implements GameStore { } /** Delete a game and all its files. */ - public boolean delete(String id) throws IOException { + public void delete(String id) throws IOException { Path dir = gameDir(id); if (Files.exists(dir)) { Files.walkFileTree(dir, new SimpleFileVisitor<>() { @@ -140,7 +139,6 @@ public class GameService implements GameStore { // Clean up old flat .jsdos locations (pre-game-dir layout — backward compat) Files.deleteIfExists(gamesDir.resolve(id + ".jsdos")); Files.deleteIfExists(gamesDir.resolve(id + ".setup.jsdos")); - return true; } /** Sanitize a string for use as a game directory ID. */ diff --git a/src/main/java/com/dostalgia/GameStore.java b/src/main/java/com/dostalgia/GameStore.java index d04e4b5..05b371c 100644 --- a/src/main/java/com/dostalgia/GameStore.java +++ b/src/main/java/com/dostalgia/GameStore.java @@ -13,7 +13,7 @@ public interface GameStore { Game load(String id) throws IOException, NoSuchFileException; void save(Game game) throws IOException; List list() throws IOException; - boolean delete(String id) throws IOException; + void delete(String id) throws IOException; Path gameDir(String id); Path gameJsonPath(String id); } diff --git a/src/main/java/com/dostalgia/IgdbController.java b/src/main/java/com/dostalgia/IgdbController.java index 3eb308f..bbbcd7e 100644 --- a/src/main/java/com/dostalgia/IgdbController.java +++ b/src/main/java/com/dostalgia/IgdbController.java @@ -5,6 +5,7 @@ import jakarta.ws.rs.Consumes; import jakarta.ws.rs.DefaultValue; import jakarta.ws.rs.GET; import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; import jakarta.ws.rs.PathParam; import jakarta.ws.rs.Produces; import jakarta.ws.rs.QueryParam; @@ -13,7 +14,7 @@ import jakarta.ws.rs.core.Response; import java.util.Map; /** IGDB metadata & artwork integration. Enabled when TWITCH_CLIENT_ID and TWITCH_CLIENT_SECRET are set. */ -@jakarta.ws.rs.Path("/api/igdb") +@Path("/api/igdb") @Produces(MediaType.APPLICATION_JSON) public class IgdbController { @@ -24,7 +25,7 @@ public class IgdbController { GameService games; @GET - @jakarta.ws.rs.Path("/search") + @Path("/search") public Response search(@QueryParam("q") @DefaultValue("") String query) { if (query.isBlank()) { return Response.status(400).entity(Map.of("error", "Query parameter 'q' is required")).build(); @@ -45,7 +46,7 @@ public class IgdbController { * Body: {} — auto-search using the game's title. */ @POST - @jakarta.ws.rs.Path("/scrape/{gameId}") + @Path("/scrape/{gameId}") @Consumes(MediaType.APPLICATION_JSON) public Response scrape(@PathParam("gameId") String gameId, Map body) { try { @@ -72,7 +73,7 @@ public class IgdbController { /** Check if IGDB credentials are configured. */ @GET - @jakarta.ws.rs.Path("/status") + @Path("/status") public Response status() { boolean configured = svc.isConfigured(); return Response.ok(Map.of(