Skip to content

Commit

Permalink
Merge branch 'main' into dev/feillytter-kun-events
Browse files Browse the repository at this point in the history
  • Loading branch information
bjerga committed Nov 7, 2024
2 parents eb21d34 + 3b83891 commit a9359aa
Show file tree
Hide file tree
Showing 26 changed files with 102 additions and 485 deletions.
8 changes: 6 additions & 2 deletions config/nais.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ spec:
gcp:
sqlInstances:
- type: POSTGRES_14
{{#if database.cascadingDelete}}
cascadingDelete: {{ database.cascadingDelete }}
{{/if}}
tier: {{ database.tier }}
databases:
- name: {{ database.name }}
Expand All @@ -73,9 +76,10 @@ spec:
{{/if}}
{{#if envFrom}}
envFrom:
{{# each envFrom as |item| }}
{{# each envFrom as |item| }}
- {{ item.type }}: {{ item.name }}
{{/each}}{{/if}}
{{/each}}
{{/if}}
env:
- name: KAFKA_CONSUMER_GROUP_ID
value: helsearbeidsgiver-im-{{app}}-v1
Expand Down
3 changes: 1 addition & 2 deletions config/notifikasjon/dev-gcp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ database:
name: notifikasjon
tier: db-custom-1-3840
logicalDecoding: true
cascadingDelete: true
envFrom:
- type: secret
name: google-sql-im-notifikasjon
secureLogs:
enabled: true
env:
- name: ARBEIDSGIVER_NOTIFIKASJON_API_URL
value: "http://notifikasjon-produsent-api.fager/api/graphql"
Expand Down
3 changes: 1 addition & 2 deletions config/notifikasjon/prod-gcp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ database:
name: notifikasjon
tier: db-custom-1-3840
logicalDecoding: true
cascadingDelete: true
envFrom:
- type: secret
name: google-sql-im-notifikasjon
secureLogs:
enabled: true
env:
- name: ARBEIDSGIVER_NOTIFIKASJON_API_URL
value: "http://notifikasjon-produsent-api.fager/api/graphql"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import no.nav.helsearbeidsgiver.felles.rapidsrivers.registerShutdownLifecycle
import no.nav.helsearbeidsgiver.inntektsmelding.db.river.HentLagretImRiver
import no.nav.helsearbeidsgiver.inntektsmelding.db.river.HentSelvbestemtImRiver
import no.nav.helsearbeidsgiver.inntektsmelding.db.river.LagreEksternImRiver
import no.nav.helsearbeidsgiver.inntektsmelding.db.river.LagreForespoerselRiver
import no.nav.helsearbeidsgiver.inntektsmelding.db.river.LagreImRiver
import no.nav.helsearbeidsgiver.inntektsmelding.db.river.LagreImSkjemaRiver
import no.nav.helsearbeidsgiver.inntektsmelding.db.river.LagreJournalpostIdRiver
Expand All @@ -25,11 +24,10 @@ fun main() {

val imRepo = InntektsmeldingRepository(database.db)
val selvbestemtImRepo = SelvbestemtImRepo(database.db)
val forespoerselRepo = ForespoerselRepository(database.db)

return RapidApplication
.create(System.getenv())
.createDbRivers(imRepo, selvbestemtImRepo, forespoerselRepo)
.createDbRivers(imRepo, selvbestemtImRepo)
.registerShutdownLifecycle {
logger.info("Stoppsignal mottatt, lukker databasetilkobling.")
database.dataSource.close()
Expand All @@ -39,12 +37,8 @@ fun main() {
fun RapidsConnection.createDbRivers(
imRepo: InntektsmeldingRepository,
selvbestemtImRepo: SelvbestemtImRepo,
forespoerselRepo: ForespoerselRepository,
): RapidsConnection =
also {
logger.info("Starter ${LagreForespoerselRiver::class.simpleName}...")
LagreForespoerselRiver(forespoerselRepo).connect(this)

logger.info("Starter ${HentLagretImRiver::class.simpleName}...")
HentLagretImRiver(imRepo).connect(this)

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ enum class BehovType {
LAGRE_IM,
LAGRE_SELVBESTEMT_IM,
OPPRETT_SELVBESTEMT_SAK,

// Asynkrone endringer
LAGRE_FORESPOERSEL, // TODO slett etter databasen er flyttet
}

@Serializable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ object Metrics {

val dbSelvbestemtIm = databaseMetric("inntektsmelding", "selvbestemt_inntektsmelding")

val dbSelvbestemtSak = databaseMetric("notifikasjon", "selvbestemt_sak")

val aaregRequest = requestMetric("Aareg")

val altinnRequest = requestMetric("Altinn")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,14 @@ import no.nav.helsearbeidsgiver.utils.json.toJson
import no.nav.helsearbeidsgiver.utils.json.toPretty
import no.nav.helsearbeidsgiver.utils.log.logger
import no.nav.helsearbeidsgiver.utils.log.sikkerLogger
import no.nav.helsearbeidsgiver.utils.wrapper.Fnr
import no.nav.helsearbeidsgiver.utils.wrapper.Orgnr
import java.util.UUID

data class Melding(
val notisType: Pri.NotisType,
val transaksjonId: UUID,
val forespoerselId: UUID,
val orgnr: Orgnr,
val fnr: Fnr,
val skalHaPaaminnelse: Boolean,
val forespoerselFraBro: ForespoerselFraBro,
val skalHaPaaminnelse: Boolean,
)

/** Tar imot notifikasjon om at det er kommet en forespørsel om arbeidsgiveropplysninger. */
Expand All @@ -42,10 +38,8 @@ class ForespoerselMottattRiver : PriObjectRiver<Melding>() {
notisType = Pri.Key.NOTIS.krev(Pri.NotisType.FORESPØRSEL_MOTTATT, Pri.NotisType.serializer(), json),
transaksjonId = UUID.randomUUID(),
forespoerselId = Pri.Key.FORESPOERSEL_ID.les(UuidSerializer, json),
orgnr = Pri.Key.ORGNR.les(Orgnr.serializer(), json),
fnr = Pri.Key.FNR.les(Fnr.serializer(), json),
skalHaPaaminnelse = Pri.Key.SKAL_HA_PAAMINNELSE.les(Boolean.serializer(), json),
forespoerselFraBro = Pri.Key.FORESPOERSEL.les(ForespoerselFraBro.serializer(), json),
skalHaPaaminnelse = Pri.Key.SKAL_HA_PAAMINNELSE.les(Boolean.serializer(), json),
)

override fun Melding.haandter(json: Map<Pri.Key, JsonElement>): Map<Key, JsonElement> {
Expand All @@ -58,12 +52,8 @@ class ForespoerselMottattRiver : PriObjectRiver<Melding>() {
Key.DATA to
mapOf(
Key.FORESPOERSEL_ID to forespoerselId.toJson(),
// TODO kan fjernes etter overgangsfase
Key.ORGNRUNDERENHET to orgnr.toJson(),
// TODO kan fjernes etter overgangsfase
Key.FNR to fnr.toJson(),
Key.SKAL_HA_PAAMINNELSE to skalHaPaaminnelse.toJson(Boolean.serializer()),
Key.FORESPOERSEL to forespoerselFraBro.toForespoersel().toJson(Forespoersel.serializer()),
Key.SKAL_HA_PAAMINNELSE to skalHaPaaminnelse.toJson(Boolean.serializer()),
).toJson(),
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,8 @@ class ForespoerselMottattRiverTest :
Key.DATA to
mapOf(
Key.FORESPOERSEL_ID to innkommendeMelding.forespoerselId.toJson(),
Key.ORGNRUNDERENHET to innkommendeMelding.orgnr.toJson(),
Key.FNR to innkommendeMelding.fnr.toJson(),
Key.SKAL_HA_PAAMINNELSE to innkommendeMelding.skalHaPaaminnelse.toJson(Boolean.serializer()),
Key.FORESPOERSEL to innkommendeMelding.forespoerselFraBro.toForespoersel().toJson(Forespoersel.serializer()),
Key.SKAL_HA_PAAMINNELSE to innkommendeMelding.skalHaPaaminnelse.toJson(Boolean.serializer()),
).toJson(),
)
}
Expand All @@ -68,24 +66,20 @@ private fun mockInnkommendeMelding(): Melding =
notisType = Pri.NotisType.FORESPØRSEL_MOTTATT,
transaksjonId = UUID.randomUUID(),
forespoerselId = UUID.randomUUID(),
orgnr = Orgnr.genererGyldig(),
fnr = Fnr.genererGyldig(),
skalHaPaaminnelse = true,
forespoerselFraBro = Mock.forespoerselFraBro,
skalHaPaaminnelse = true,
)

private fun Melding.toMap(): Map<Pri.Key, JsonElement> =
mapOf(
Pri.Key.NOTIS to notisType.toJson(Pri.NotisType.serializer()),
Pri.Key.FORESPOERSEL_ID to forespoerselId.toJson(),
Pri.Key.ORGNR to orgnr.toJson(),
Pri.Key.FNR to fnr.toJson(),
Pri.Key.SKAL_HA_PAAMINNELSE to skalHaPaaminnelse.toJson(Boolean.serializer()),
Pri.Key.FORESPOERSEL to forespoerselFraBro.toJson(ForespoerselFraBro.serializer()),
Pri.Key.SKAL_HA_PAAMINNELSE to skalHaPaaminnelse.toJson(Boolean.serializer()),
)

object Mock {
val orgnr = Orgnr.genererGyldig()
private val orgnr = Orgnr.genererGyldig()
val forespoerselFraBro =
ForespoerselFraBro(
orgnr = orgnr,
Expand Down
Loading

0 comments on commit a9359aa

Please sign in to comment.