Skip to content

Commit

Permalink
Merge branch 'master' into feature/oppgavev3_reservasjonstjeneste
Browse files Browse the repository at this point in the history
  • Loading branch information
boerta authored Oct 6, 2023
2 parents cf275a2 + 253e6f4 commit afbb90c
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ val k9KlageVersion = "0.4.0"
val fuelVersion = "2.3.1"
val jacksonVersion = "2.15.2"

val dusseldorfKtorVersion = "4.0.8"
val dusseldorfKtorVersion = "4.0.10"
val ktorVersion = "2.3.4"
val kafkaVersion = "3.5.1"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ import javax.sql.DataSource

class OppgaveKoRepository(val datasource: DataSource) {

private val standardOppgaveString: String by lazy {
val objectMapper = jacksonObjectMapper()
val standardOppgaveQuery = objectMapper.readValue(
OppgaveKoRepository::class.java.getResource("/los/standard-ko.json")!!.readText(),
OppgaveQuery::class.java
)
objectMapper.writeValueAsString(standardOppgaveQuery)
}

fun hentListe(): OppgaveKoListeDto {
return using(sessionOf(datasource)) { it ->
it.transaction { tx -> hentListe(tx) }
Expand Down Expand Up @@ -72,15 +81,14 @@ class OppgaveKoRepository(val datasource: DataSource) {
}

fun leggTil(tx: TransactionalSession, tittel: String): OppgaveKo {
val objectMapper = jacksonObjectMapper()
val oppgaveKoId = tx.run(
queryOf(
"""
INSERT INTO OPPGAVEKO_V3 (versjon, tittel, beskrivelse, query, fritt_valg_av_oppgave, endret_tidspunkt)
VALUES (0, :tittel, '', :query, false, :endret_tidspunkt) RETURNING ID""",
mapOf(
"tittel" to tittel,
"query" to objectMapper.writeValueAsString(OppgaveQuery()),
"query" to standardOppgaveString,
"endret_tidspunkt" to LocalDateTime.now()
)
).map{row -> row.long(1)}.asSingle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class OppgaveQuery(
val filtere: List<Oppgavefilter>,
val select: List<SelectFelt> = listOf(),
val order: List<OrderFelt> = listOf(),
val limit: Int = 10
val limit: Int = -1
) {

constructor() : this(listOf(), listOf(), listOf(), 10);
Expand Down
22 changes: 22 additions & 0 deletions src/main/resources/los/standard-ko.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"filtere": [
{
"type": "feltverdi",
"område": null,
"kode": "oppgavestatus",
"operator": "IN",
"verdi": [
"AAPEN"
]
}
],
"select": [],
"order": [
{
"type": "enkel",
"område": "K9",
"kode": "mottattDato",
"økende": true
}
]
}

0 comments on commit afbb90c

Please sign in to comment.