From c72b54b13d47edf1e6281d441c6767f457b654e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Hagen?= Date: Fri, 22 Nov 2024 13:24:06 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=8A=20Logger=20dersom=20snapshot=20ikk?= =?UTF-8?q?e=20inneholder=20forventet=20fnr?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../helse/spesialist/api/snapshot/SnapshotApiDao.kt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/spesialist-api/src/main/kotlin/no/nav/helse/spesialist/api/snapshot/SnapshotApiDao.kt b/spesialist-api/src/main/kotlin/no/nav/helse/spesialist/api/snapshot/SnapshotApiDao.kt index 52f52b041..daff4add0 100644 --- a/spesialist-api/src/main/kotlin/no/nav/helse/spesialist/api/snapshot/SnapshotApiDao.kt +++ b/spesialist-api/src/main/kotlin/no/nav/helse/spesialist/api/snapshot/SnapshotApiDao.kt @@ -10,9 +10,14 @@ import no.nav.helse.spesialist.api.graphql.schema.Personinfo import no.nav.helse.spesialist.api.objectMapper import no.nav.helse.spleis.graphql.hentsnapshot.GraphQLPerson import org.intellij.lang.annotations.Language +import org.slf4j.LoggerFactory import javax.sql.DataSource class SnapshotApiDao(private val dataSource: DataSource) { + private companion object { + private val sikkerLogg = LoggerFactory.getLogger("tjenestekall") + } + fun hentSnapshotMedMetadata(fødselsnummer: String): Pair? = sessionOf(dataSource).use { session -> @Language("PostgreSQL") @@ -56,7 +61,11 @@ class SnapshotApiDao(private val dataSource: DataSource) { if (versjon > tx.finnGlobalVersjon()) { tx.oppdaterGlobalVersjon(versjon) } - tx.lagre(personRef, objectMapper.writeValueAsString(snapshot), versjon) + val snapshotJson = objectMapper.writeValueAsString(snapshot) + if (!snapshotJson.contains(fødselsnummer)) { + sikkerLogg.warn("Henter snapshot for fnr $fødselsnummer, mottar snapshot: $snapshotJson") + } + tx.lagre(personRef, snapshotJson, versjon) } } }