Removed unused code

This commit is contained in:
2025-08-10 16:30:06 -04:00
parent 177a4303bc
commit 5f28ee67dd
2 changed files with 7 additions and 11 deletions

View File

@@ -1,8 +1,5 @@
package codes.kalar package codes.kalar
import codes.kalar.service.CollectionItemService
import com.auth0.jwt.JWT
import com.auth0.jwt.algorithms.Algorithm
import io.ktor.http.* import io.ktor.http.*
import io.ktor.serialization.kotlinx.json.* import io.ktor.serialization.kotlinx.json.*
import io.ktor.server.application.* import io.ktor.server.application.*
@@ -17,9 +14,8 @@ import io.ktor.server.routing.*
import java.sql.Connection import java.sql.Connection
import java.sql.DriverManager import java.sql.DriverManager
fun Application.configureDatabases() { // Maybe will use in the future
val dbConnection: Connection = connectToPostgres() fun Application.configureDatabases() {}
}
/** /**
* Makes a connection to a Postgres database. * Makes a connection to a Postgres database.

View File

@@ -25,7 +25,7 @@ class CollectionItemService(private val connection: Connection) {
private const val ARCHIVE_ITEM_BY_ID = "UPDATE collection_item SET is_archived = true WHERE id = ?" private const val ARCHIVE_ITEM_BY_ID = "UPDATE collection_item SET is_archived = true WHERE id = ?"
} }
suspend fun create(newCollectionItem: NewCollectionItem): Long { fun create(newCollectionItem: NewCollectionItem): Long {
val statement = connection.prepareStatement(INSERT_ITEM, val statement = connection.prepareStatement(INSERT_ITEM,
Statement.RETURN_GENERATED_KEYS) Statement.RETURN_GENERATED_KEYS)
statement.setString(1, newCollectionItem.title) statement.setString(1, newCollectionItem.title)
@@ -60,7 +60,7 @@ class CollectionItemService(private val connection: Connection) {
} }
} }
suspend fun readByTitle(inputTitle: String, offset: Int = 0): MutableList<String> { fun readByTitle(inputTitle: String, offset: Int = 0): MutableList<String> {
val itemList = mutableListOf<String>() val itemList = mutableListOf<String>()
// FUZZY SEARCH!!!! // FUZZY SEARCH!!!!
val statement = connection.prepareStatement(SELECT_ITEM_BY_TITLE) val statement = connection.prepareStatement(SELECT_ITEM_BY_TITLE)
@@ -80,7 +80,7 @@ class CollectionItemService(private val connection: Connection) {
return itemList return itemList
} }
suspend fun readById(id: Long): CollectionItem { fun readById(id: Long): CollectionItem {
val statement = connection.prepareStatement(SELECT_ITEM_BY_ID) val statement = connection.prepareStatement(SELECT_ITEM_BY_ID)
statement.setLong(1, id) statement.setLong(1, id)
try { try {
@@ -96,7 +96,7 @@ class CollectionItemService(private val connection: Connection) {
} }
} }
suspend fun update(collectionItem: CollectionItem): Boolean { fun update(collectionItem: CollectionItem): Boolean {
val statement = connection.prepareStatement(UPDATE_ITEM_BY_ID) val statement = connection.prepareStatement(UPDATE_ITEM_BY_ID)
try { try {
statement.setString(1, collectionItem.title) statement.setString(1, collectionItem.title)
@@ -127,7 +127,7 @@ class CollectionItemService(private val connection: Connection) {
} }
} }
suspend fun delete(id: Long) { fun delete(id: Long) {
val statement = connection.prepareStatement(ARCHIVE_ITEM_BY_ID) val statement = connection.prepareStatement(ARCHIVE_ITEM_BY_ID)
try { try {
statement.setLong(1, id) statement.setLong(1, id)