🚧 Påbegynt oppdater feilmeldinger
This commit is contained in:
parent
2c1951e60b
commit
719a9b39ef
7 changed files with 34 additions and 11 deletions
|
@ -5,6 +5,7 @@ import no.nav.helse.sprik.db.FeilmeldingTable.arbeidsstatus
|
|||
import no.nav.helse.sprik.db.FeilmeldingTable.beskrivelse
|
||||
import no.nav.helse.sprik.db.FeilmeldingTable.dato
|
||||
import no.nav.helse.sprik.db.FeilmeldingTable.haster
|
||||
import no.nav.helse.sprik.db.FeilmeldingTable.id
|
||||
import no.nav.helse.sprik.db.FeilmeldingTable.tittel
|
||||
import no.nav.helse.sprik.modell.Feilmelding
|
||||
import org.jetbrains.exposed.sql.*
|
||||
|
@ -20,14 +21,13 @@ class FeilmeldingRepository {
|
|||
it[FeilmeldingTable.tittel] = feilmelding.tittel
|
||||
it[FeilmeldingTable.beskrivelse] = feilmelding.beskrivelse
|
||||
it[FeilmeldingTable.dato] = feilmelding.dato
|
||||
it[FeilmeldingTable.arbeidsstatus] = feilmelding.arbeidsstatus
|
||||
it[FeilmeldingTable.haster] = feilmelding.haster
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun radTilFeilmelding(rad: ResultRow) = Feilmelding(
|
||||
id = rad[id],
|
||||
tittel = rad[tittel],
|
||||
beskrivelse = rad[beskrivelse],
|
||||
dato = rad[dato],
|
||||
|
@ -47,4 +47,13 @@ class FeilmeldingRepository {
|
|||
.map(::radTilFeilmelding)
|
||||
|
||||
}
|
||||
|
||||
fun hentFeilmelding(id: String) = transaction {
|
||||
TODO()
|
||||
FeilmeldingTable.id
|
||||
}
|
||||
|
||||
fun oppdaterFeilmelding(id: String): Nothing = transaction {
|
||||
TODO()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import org.jetbrains.exposed.sql.Table
|
|||
import org.jetbrains.exposed.sql.javatime.datetime
|
||||
|
||||
object FeilmeldingTable : Table("feilmelding") {
|
||||
val id = integer("id")
|
||||
val tittel = text("tittel")
|
||||
val beskrivelse = text("beskrivelse")
|
||||
val dato = datetime("dato")
|
||||
|
|
|
@ -14,10 +14,11 @@ import java.time.LocalDateTime
|
|||
* */
|
||||
@Serializable
|
||||
class Feilmelding(
|
||||
val id: Int?,
|
||||
val tittel: String,
|
||||
val beskrivelse: String,
|
||||
val dato: LocalDateTime, //Krever en spesiallaget serialiserer i KotlinX
|
||||
val arbeidsstatus: Int,
|
||||
val arbeidsstatus: Int?,
|
||||
val haster: Boolean
|
||||
//val bilde: String,
|
||||
) {
|
||||
|
|
|
@ -23,6 +23,7 @@ fun configureRouting(): ApplicationEngine = embeddedServer(CIO, applicationEngin
|
|||
anyHost()
|
||||
allowMethod(HttpMethod.Get)
|
||||
allowMethod(HttpMethod.Post)
|
||||
allowMethod(HttpMethod.Put)
|
||||
allowNonSimpleContentTypes = true
|
||||
}
|
||||
install(ContentNegotiation) {
|
||||
|
@ -61,6 +62,11 @@ 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"]
|
||||
val oppdatertFeilmelding = call.receive<Feilmelding>()
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
connector {
|
||||
|
|
Reference in a new issue