Skip to content

Commit

Permalink
Merge pull request #4679 from navikt/fix/arrangor-query
Browse files Browse the repository at this point in the history
Fix getHovedenhetBy query
  • Loading branch information
fredrikpe authored Nov 25, 2024
2 parents 3bd0c0e + d032a27 commit 0d72114
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ class ArrangorRepository(private val db: Database) {
order by navn
""".trimIndent()

val underenheter = queryOf(queryForUnderenheter, arrangor.organisasjonsnummer)
val underenheter = queryOf(queryForUnderenheter, arrangor.organisasjonsnummer.value)
.map { it.toVirksomhetDto() }
.asList
.let { db.run(it) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,24 @@ class ArrangorRepositoryTest : FunSpec({
it.items[0] shouldBe underenhet
}
}

test("getByHovedenhet") {
val hovedenhet = ArrangorFixtures.hovedenhet
val underenhet = ArrangorFixtures.underenhet1

MulighetsrommetTestDomain(
arrangorer = listOf(hovedenhet, underenhet),
tiltakstyper = listOf(TiltakstypeFixtures.Oppfolging),
avtaler = listOf(AvtaleFixtures.oppfolging),
gjennomforinger = listOf(TiltaksgjennomforingFixtures.Oppfolging1),
).initialize(database.db)

val arrangorRepository = ArrangorRepository(database.db)

arrangorRepository.getHovedenhetBy(hovedenhet.id).should {
it.underenheter?.map { it.id } shouldContainExactlyInAnyOrder listOf(underenhet.id)
}
}
}

context("kontaktperson hos arrangør") {
Expand Down

0 comments on commit 0d72114

Please sign in to comment.