Skip to content

Commit

Permalink
🐛 Kan lagre historikkinnslag knyttet til oppgaveId i TransactionalPer…
Browse files Browse the repository at this point in the history
…iodehistorikkDao
  • Loading branch information
chsko committed Oct 24, 2024
1 parent ae56843 commit 500c3f1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
package no.nav.helse.db

import kotliquery.sessionOf
import no.nav.helse.mediator.oppgave.OppgaveDao
import no.nav.helse.modell.periodehistorikk.HistorikkinnslagDto
import java.util.UUID
import javax.sql.DataSource

class PgHistorikkinnslagRepository(
private val dataSource: DataSource,
) : HistorikkinnslagRepository {
private val oppgaveDao = OppgaveDao(dataSource)

override fun lagre(
historikkinnslag: HistorikkinnslagDto,
oppgaveId: Long,
) {
val generasjonId = oppgaveDao.finnGenerasjonId(oppgaveId)
lagre(historikkinnslag, generasjonId)
sessionOf(dataSource, returnGeneratedKey = true).use { session ->
TransactionalPeriodehistorikkDao(session).lagre(historikkinnslag, oppgaveId)
}
}

override fun lagre(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,15 @@ import java.util.UUID
class TransactionalPeriodehistorikkDao(
private val session: Session,
) : HistorikkinnslagRepository {
val oppgaveDao = TransactionalOppgaveDao(session)

override fun lagre(
historikkinnslag: HistorikkinnslagDto,
oppgaveId: Long,
): Unit = throw UnsupportedOperationException()
) {
val generasjonId = oppgaveDao.finnGenerasjonId(oppgaveId)
lagre(historikkinnslag, generasjonId)
}

override fun lagre(
historikkinnslag: HistorikkinnslagDto,
Expand Down

0 comments on commit 500c3f1

Please sign in to comment.