Save pin to PG

This commit is contained in:
P0nk
2024-09-27 06:50:07 +02:00
parent 0f2ef341ce
commit f33d4fbc1c
5 changed files with 63 additions and 22 deletions

View File

@@ -55,4 +55,17 @@ public class AccountRepository {
.execute();
}
}
public boolean setPin(int accountId, String pin) {
String sql = """
UPDATE account
SET pin = :pin
WHERE id = :id""";
try (Handle handle = connection.getHandle()) {
return handle.createUpdate(sql)
.bind("id", accountId)
.bind("pin", pin)
.execute() > 0;
}
}
}