From 4cdd063851d55477363323925de21b98fe2d45a5 Mon Sep 17 00:00:00 2001 From: Sindre Kjelsrud Date: Wed, 2 Aug 2023 16:01:53 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fikser=20oppdaterfeil=20routing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Amalie Erdal Mansåker --- .../src/main/kotlin/no/nav/helse/sprik/plugins/Routing.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/backend/src/main/kotlin/no/nav/helse/sprik/plugins/Routing.kt b/backend/src/main/kotlin/no/nav/helse/sprik/plugins/Routing.kt index f2b9514..470c93d 100644 --- a/backend/src/main/kotlin/no/nav/helse/sprik/plugins/Routing.kt +++ b/backend/src/main/kotlin/no/nav/helse/sprik/plugins/Routing.kt @@ -12,7 +12,10 @@ import io.ktor.server.http.content.* import io.ktor.server.plugins.cors.routing.* import io.ktor.server.request.* import no.nav.helse.sprik.db.FeilmeldingRepository +import no.nav.helse.sprik.db.FeilmeldingTable import no.nav.helse.sprik.modell.Feilmelding +import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq +import org.jetbrains.exposed.sql.update fun configureRouting(): ApplicationEngine = embeddedServer(CIO, applicationEngineEnvironment { //Repositories for handlinger mot database: @@ -62,9 +65,9 @@ fun configureRouting(): ApplicationEngine = embeddedServer(CIO, applicationEngin val sokeresultat = feilmeldingRepository.hentSokteFeilmeldinger(sokestreng) call.respond(status = HttpStatusCode.Created, message = sokeresultat) } - put("/api/oppdaterfeil/{id}") { - val id = call.parameters["id"] + put("/api/oppdaterfeil") { val oppdatertFeilmelding = call.receive() + feilmeldingRepository.oppdaterFeilmelding(oppdatertFeilmelding) call.respond(status = HttpStatusCode.Created, message = "Feilmelding oppdatert") } }