Rename "temp_ban_timestamp" -> "temp_banned_until"
This commit is contained in:
@@ -12,8 +12,8 @@ import java.util.Objects;
|
||||
*/
|
||||
@Builder
|
||||
public record Account(int id, String name, String password, boolean acceptedTos, Byte gender, LocalDate birthdate,
|
||||
String pin, String pic, byte chrSlots, LoginState loginState, LocalDateTime lastLogin, boolean banned,
|
||||
LocalDateTime tempBanTimestamp) {
|
||||
String pin, String pic, byte chrSlots, LoginState loginState, LocalDateTime lastLogin,
|
||||
boolean banned, LocalDateTime tempBannedUntil) {
|
||||
public Account {
|
||||
Objects.requireNonNull(name);
|
||||
Objects.requireNonNull(password);
|
||||
|
||||
@@ -20,7 +20,7 @@ public class AccountRepository {
|
||||
public Optional<Account> findByNameIgnoreCase(String name) {
|
||||
String sql = """
|
||||
SELECT id, name, password, pin, pic, birthdate, gender, tos_accepted, chr_slots, login_state,
|
||||
last_login, banned, temp_ban_timestamp
|
||||
last_login, banned, temp_banned_until
|
||||
FROM account
|
||||
WHERE lower(name) = lower(:name)""";
|
||||
try (Handle handle = connection.getHandle()) {
|
||||
@@ -34,7 +34,7 @@ public class AccountRepository {
|
||||
public Optional<Account> findById(int accountId) {
|
||||
String sql = """
|
||||
SELECT id, name, password, pin, pic, birthdate, gender, tos_accepted, chr_slots, login_state,
|
||||
last_login, banned, temp_ban_timestamp
|
||||
last_login, banned, temp_banned_until
|
||||
FROM account
|
||||
WHERE id = :id""";
|
||||
try (Handle handle = connection.getHandle()) {
|
||||
@@ -55,7 +55,7 @@ public class AccountRepository {
|
||||
.bind("password", account.password())
|
||||
.bind("birthdate", account.birthdate())
|
||||
.bind("chrSlots", account.chrSlots())
|
||||
.bind("loginState", account.loginState())
|
||||
.bind("loginState", account.loginState().getValue())
|
||||
.executeAndReturnGeneratedKeys("id")
|
||||
.mapTo(Integer.class)
|
||||
.one();
|
||||
|
||||
@@ -35,7 +35,7 @@ public class AccountRowMapper implements RowMapper<Account> {
|
||||
.map(Timestamp::toLocalDateTime)
|
||||
.orElse(null))
|
||||
.banned(rs.getBoolean("banned"))
|
||||
.tempBanTimestamp(Optional.ofNullable(rs.getTimestamp("temp_ban_timestamp"))
|
||||
.tempBannedUntil(Optional.ofNullable(rs.getTimestamp("temp_banned_until"))
|
||||
.map(Timestamp::toLocalDateTime)
|
||||
.orElse(null))
|
||||
.build();
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
CREATE TABLE account
|
||||
(
|
||||
id serial NOT NULL,
|
||||
name varchar(30) NOT NULL,
|
||||
password varchar(200) NOT NULL,
|
||||
pin varchar(4),
|
||||
pic varchar(26),
|
||||
created_at timestamp DEFAULT now() NOT NULL,
|
||||
birthdate date NOT NULL,
|
||||
tos_accepted boolean DEFAULT false NOT NULL,
|
||||
gender smallint,
|
||||
chr_slots smallint NOT NULL,
|
||||
nx_credit integer DEFAULT 0 NOT NULL,
|
||||
maple_point integer DEFAULT 0 NOT NULL,
|
||||
nx_prepaid integer DEFAULT 0 NOT NULL,
|
||||
login_state smallint NOT NULL,
|
||||
last_login timestamp,
|
||||
banned boolean DEFAULT false NOT NULL,
|
||||
banreason text,
|
||||
temp_ban_timestamp timestamp,
|
||||
greason smallint,
|
||||
ip text,
|
||||
hwid text,
|
||||
macs text,
|
||||
id serial NOT NULL,
|
||||
name varchar(30) NOT NULL,
|
||||
password varchar(200) NOT NULL,
|
||||
pin varchar(4),
|
||||
pic varchar(26),
|
||||
created_at timestamp DEFAULT now() NOT NULL,
|
||||
birthdate date NOT NULL,
|
||||
tos_accepted boolean DEFAULT false NOT NULL,
|
||||
gender smallint,
|
||||
chr_slots smallint NOT NULL,
|
||||
nx_credit integer DEFAULT 0 NOT NULL,
|
||||
maple_point integer DEFAULT 0 NOT NULL,
|
||||
nx_prepaid integer DEFAULT 0 NOT NULL,
|
||||
login_state smallint NOT NULL,
|
||||
last_login timestamp,
|
||||
banned boolean DEFAULT false NOT NULL,
|
||||
banreason text,
|
||||
temp_banned_until timestamp,
|
||||
greason smallint,
|
||||
ip text,
|
||||
hwid text,
|
||||
macs text,
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE (name)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user