Code cleanup
This commit is contained in:
@@ -21,7 +21,7 @@ class PatronService(private val connection: Connection) {
|
||||
private const val ARCHIVE_PATRON_BY_ID = "UPDATE patron set is_archived = true WHERE id = ?"
|
||||
}
|
||||
|
||||
suspend fun create(newPatron: NewPatron): Long {
|
||||
fun create(newPatron: NewPatron): Long {
|
||||
val statement = connection.prepareStatement(INSERT_PATRON, Statement.RETURN_GENERATED_KEYS)
|
||||
statement.setString(1, newPatron.name)
|
||||
statement.setBoolean(2, true)
|
||||
@@ -42,7 +42,7 @@ class PatronService(private val connection: Connection) {
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun readPatronById(id: Long): Patron {
|
||||
fun readPatronById(id: Long): Patron {
|
||||
try {
|
||||
val statement = connection.prepareStatement(SELECT_PATRON_BY_ID, Statement.RETURN_GENERATED_KEYS)
|
||||
statement.setLong(1, id)
|
||||
@@ -58,7 +58,7 @@ class PatronService(private val connection: Connection) {
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun readPatronByLoginUsername(username: String): Patron {
|
||||
fun readPatronByLoginUsername(username: String): Patron {
|
||||
try {
|
||||
val statement = connection.prepareStatement(SELECT_PATRON_BY_LOGIN_USERNAME)
|
||||
statement.setString(1, username)
|
||||
@@ -74,7 +74,7 @@ class PatronService(private val connection: Connection) {
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun loginPatronByLoginUsername(username: String, password: String): Boolean {
|
||||
fun loginPatronByLoginUsername(username: String, password: String): Boolean {
|
||||
try {
|
||||
val statement = connection.prepareStatement(SELECT_PATRON_BY_LOGIN_USERNAME)
|
||||
statement.setString(1, username)
|
||||
@@ -89,7 +89,7 @@ class PatronService(private val connection: Connection) {
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun update(patron: Patron): Boolean {
|
||||
fun update(patron: Patron): Boolean {
|
||||
val statement = connection.prepareStatement(UPDATE_PATRON_BY_ID)
|
||||
statement.setString(1, patron.name)
|
||||
statement.setBoolean(2, patron.hasGoodStanding)
|
||||
@@ -106,7 +106,7 @@ class PatronService(private val connection: Connection) {
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun delete(id: Long) {
|
||||
fun delete(id: Long) {
|
||||
val statement = connection.prepareStatement(ARCHIVE_PATRON_BY_ID)
|
||||
statement.setLong(1, id)
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user