Set ban through AccountService
This commit is contained in:
@@ -14,6 +14,7 @@ import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Optional;
|
||||
@@ -66,6 +67,10 @@ public class AccountService {
|
||||
return accountRepository.findById(accountId);
|
||||
}
|
||||
|
||||
public Optional<Account> getAccountIdByChrName(String chrName) {
|
||||
return accountRepository.findIdByChrNameIgnoreCase(chrName);
|
||||
}
|
||||
|
||||
public boolean acceptTos(int accountId) {
|
||||
acceptTosMysql(accountId);
|
||||
acceptTosPostgres(accountId);
|
||||
@@ -274,4 +279,13 @@ public class AccountService {
|
||||
}
|
||||
}
|
||||
|
||||
public void permaBan(int accountId, byte banReason, String description) {
|
||||
accountRepository.setBanned(accountId, null, banReason, description);
|
||||
}
|
||||
|
||||
public void tempBan(int accountId, Duration duration, byte banReason, String description) {
|
||||
Instant bannedUntil = Instant.now().plus(duration);
|
||||
accountRepository.setBanned(accountId, bannedUntil, banReason, description);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user