diff --git a/src/main/java/app/services/db/DiscordAuthService.java b/src/main/java/app/services/db/DiscordAuthService.java index 2ed8ef0..90d3ecf 100644 --- a/src/main/java/app/services/db/DiscordAuthService.java +++ b/src/main/java/app/services/db/DiscordAuthService.java @@ -24,7 +24,7 @@ public class DiscordAuthService { public SteamID getSteamIDofDiscordID(String discord_id) { return jdbcTemplate.query("SELECT steam_id FROM steam2discord WHERE discord_id = ? AND active = 1 LIMIT 1", - new Object[]{ discord_id }, + new Object[]{ Long.parseLong(discord_id) }, (rs, n) -> SteamIDConverter.getSteamID(rs.getString("steam_id"))) .stream().findFirst().orElse(null); } @@ -32,13 +32,13 @@ public class DiscordAuthService { public String getDiscordIDofSteamID(SteamID steamID) { return jdbcTemplate.query("SELECT discord_id FROM steam2discord WHERE steam_id = ? AND active = 1 LIMIT 1", new Object[]{ steamID.steam2 }, - (rs, n) -> rs.getString("discord_id")) - .stream().findFirst().orElse(null); + (rs, n) -> rs.getLong("discord_id")) + .stream().map(Object::toString).findFirst().orElse(null); } public boolean setSteamIDofDiscordID(SteamID steamID, String discord_id) { return jdbcTemplate.update("INSERT INTO steam2discord (steam_id, discord_id, timestamp, active) VALUES (?, ?, current_timestamp, 1)", - steamID.steam2, discord_id) > 0; + steamID.steam2, Long.parseLong(discord_id)) > 0; } public boolean removeSteamIDofDiscordID(SteamID steamID) { @@ -49,7 +49,7 @@ public class DiscordAuthService { public List getAccountsNotInList(List discord_accounts) { String inSql = String.join(",", Collections.nCopies(discord_accounts.size(), "?")); return jdbcTemplate.query("SELECT discord_id FROM steam2discord WHERE active = 1 AND discord_id in (" + inSql + ")", - discord_accounts.toArray(), + discord_accounts.stream().mapToLong(Long::parseLong).mapToObj(x -> (Object) x).toArray(), (rs, n) -> rs.getString("discord_id")); }