|
|
@ -23,21 +23,21 @@ public class DiscordAuthService { |
|
|
|
private HashMap<String, List<String>> processing_accounts = new HashMap<>(); |
|
|
|
|
|
|
|
public SteamID getSteamIDofDiscordID(String discord_id) { |
|
|
|
return jdbcTemplate.query("SELECT steam_id FROM steam2discord WHERE discord_id = ? AND active = true LIMIT 1", |
|
|
|
return jdbcTemplate.query("SELECT steam_id FROM steam2discord WHERE discord_id = ? AND active = 1 LIMIT 1", |
|
|
|
new Object[]{ discord_id }, |
|
|
|
(rs, n) -> SteamIDConverter.getSteamID(rs.getString("steam_id"))) |
|
|
|
.stream().findFirst().orElse(null); |
|
|
|
} |
|
|
|
|
|
|
|
public String getDiscordIDofSteamID(SteamID steamID) { |
|
|
|
return jdbcTemplate.query("SELECT discord_id FROM steam2discord WHERE steam_id = ? AND active = true LIMIT 1", |
|
|
|
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); |
|
|
|
} |
|
|
|
|
|
|
|
public boolean setSteamIDofDiscordID(SteamID steamID, String discord_id) { |
|
|
|
return jdbcTemplate.update("INSERT INTO steam2discord (steam_id, discord_id, timestamp, active) VALUES (?, ?, current_timestamp, true)", |
|
|
|
return jdbcTemplate.update("INSERT INTO steam2discord (steam_id, discord_id, timestamp, active) VALUES (?, ?, current_timestamp, 1)", |
|
|
|
steamID.steam2, discord_id) > 0; |
|
|
|
} |
|
|
|
|
|
|
@ -48,7 +48,7 @@ public class DiscordAuthService { |
|
|
|
|
|
|
|
public List<String> getAccountsNotInList(List<String> discord_accounts) { |
|
|
|
String inSql = String.join(",", Collections.nCopies(discord_accounts.size(), "?")); |
|
|
|
return jdbcTemplate.query("SELECT discord_id FROM steam2discord WHERE active = true AND discord_id in (" + inSql + ")", |
|
|
|
return jdbcTemplate.query("SELECT discord_id FROM steam2discord WHERE active = 1 AND discord_id in (" + inSql + ")", |
|
|
|
discord_accounts.toArray(), |
|
|
|
(rs, n) -> rs.getString("discord_id")); |
|
|
|
} |
|
|
|