Browse Source

Ban history

master
gsd 2 years ago
parent
commit
b58044e821
  1. 11
      src/main/java/app/services/db/BanService.java

11
src/main/java/app/services/db/BanService.java

@ -32,6 +32,17 @@ public class BanService {
return result.stream().map(Ban::new).findFirst().orElse(null);
}
public List<Ban> getBans(SteamID steamID) {
List<Object[]> result = entityManager.createNativeQuery("SELECT * FROM light_bans WHERE account_id = ?1 AND active = 0")
.setParameter(1, steamID.account_id)
.getResultList();
return result.stream().map(Ban::new).toList();
}
public Long getBansCount(SteamID steamID) {
return (Long) entityManager.createNativeQuery("SELECT COUNT(*) FROM light_bans WHERE account_id = ?1 AND active = 0").getSingleResult();
}
@Transactional
public boolean removeBan(PlayerProfile user, PlayerProfile admin) {
Ban ban = getBan(user.getSteamids());

Loading…
Cancel
Save