diff --git a/src/api/route/InputServiceServer.kt b/src/api/route/InputServiceServer.kt index 0c86f20..62455f8 100644 --- a/src/api/route/InputServiceServer.kt +++ b/src/api/route/InputServiceServer.kt @@ -117,7 +117,7 @@ class InputServiceServer { get("/sample/{tagID}") { val tagID = call.parameters["tagID"] ?: error(HttpStatusCode.NotAcceptable) - val resultObject = resultObjectService.getInputObjectbyTag(tagID) ?: call.respond(HttpStatusCode.NotFound) + val resultObject = resultObjectService.getInputObjectbyTag(UUID.fromString(tagID)) ?: call.respond(HttpStatusCode.NotFound) call.respond(resultObject) } diff --git a/src/database/service/IInputObjectService.kt b/src/database/service/IInputObjectService.kt index 40179e7..e36ea78 100644 --- a/src/database/service/IInputObjectService.kt +++ b/src/database/service/IInputObjectService.kt @@ -2,9 +2,10 @@ package com.kmalbz.database.service import com.kmalbz.api.model.ApiObject import java.time.LocalDate +import java.util.* interface IInputObjectService{ fun addOne(apiObject: ApiObject) suspend fun getAllInputObjects(): List - suspend fun getInputObjectbyTag(tag: String): ApiObject? + suspend fun getInputObjectbyTag(tag: UUID): ApiObject? } \ No newline at end of file diff --git a/src/database/service/InputObjectService.kt b/src/database/service/InputObjectService.kt index e54d76d..01ea3ef 100644 --- a/src/database/service/InputObjectService.kt +++ b/src/database/service/InputObjectService.kt @@ -9,6 +9,7 @@ import org.jetbrains.exposed.sql.select import org.jetbrains.exposed.sql.selectAll import org.jetbrains.exposed.sql.transactions.transaction import java.time.LocalDate +import java.util.* class InputObjectService : IInputObjectService { @@ -26,7 +27,7 @@ class InputObjectService : IInputObjectService { InputObjects.selectAll().map { toInputObject(it) } } - override suspend fun getInputObjectbyTag(tag: String): ApiObject? = dbQuery { + override suspend fun getInputObjectbyTag(tag: UUID): ApiObject? = dbQuery { InputObjects.select { (InputObjects.tag eq tag) }.mapNotNull { toInputObject(it) }