package se.svennesson.authserver.dao.mappers;

import org.skife.jdbi.v2.StatementContext;
import org.skife.jdbi.v2.tweak.ResultSetMapper;
import se.svennesson.authserver.models.LoginAttempt;

import java.sql.ResultSet;
import java.sql.SQLException;

public class LoginAttemptsMapper implements ResultSetMapper<LoginAttempt>{

    @Override
    public LoginAttempt map(int i, ResultSet resultSet, StatementContext statementContext) throws SQLException {
        return new LoginAttempt(resultSet.getLong("id"), resultSet.getLong("user_id"), resultSet.getBoolean("success"), resultSet.getTimestamp("timestampz").toLocalDateTime());
    }
}

@@ -241,16 +241,114 @@
 ception;
+%0Aimport java.time.ZoneId;%0Aimport java.time.ZoneOffset;%0Aimport java.time.temporal.TemporalAccessor;
 %0A%0Apublic
@@ -576,16 +576,33 @@
 Attempt(
+%0A                
 resultSe
@@ -613,24 +613,40 @@
 tLong(%22id%22),
+%0A               
  resultSet.g
@@ -663,16 +663,32 @@
 er_id%22),
+%0A               
  resultS
@@ -712,16 +712,32 @@
 ccess%22),
+%0A               
  resultS
@@ -783,16 +783,88 @@
 teTime()
+.atZone(ZoneId.ofOffset(%22UTC%22, ZoneOffset.ofHours(2))).toLocalDateTime()
 );%0A    %7D

Fix some timezone errors