Skip to content

Commit

Permalink
går over til precondition-apiet
Browse files Browse the repository at this point in the history
  • Loading branch information
davidsteinsland committed Nov 14, 2024
1 parent bf63bf4 commit a3238e0
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/main/kotlin/no/nav/helse/sporbar/AnnulleringRiver.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ class AnnulleringRiver(
River.PacketListener {
init {
River(rapidsConnection).apply {
precondition { it.requireValue("@event_name", "utbetaling_annullert") }
validate {
it.demandValue("@event_name", "utbetaling_annullert")
it.requireKey(
"@id",
"fødselsnummer",
Expand Down
4 changes: 3 additions & 1 deletion src/main/kotlin/no/nav/helse/sporbar/NyttDokumentRiver.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ internal class NyttDokumentRiver(rapidsConnection: RapidsConnection, private val
}
init {
River(rapidsConnection).apply {
precondition {
it.requireAny("@event_name", listOf("inntektsmelding", "ny_søknad", "sendt_søknad_nav", "sendt_søknad_arbeidsgiver", "sendt_søknad_arbeidsledig"))
}
validate {
it.demandAny("@event_name", listOf("inntektsmelding", "ny_søknad", "sendt_søknad_nav", "sendt_søknad_arbeidsgiver", "sendt_søknad_arbeidsledig"))
it.requireKey("@opprettet")
it.require("@id") { id -> UUID.fromString(id.asText()) }
it.interestedIn("inntektsmeldingId") { id -> UUID.fromString(id.asText()) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ internal class UtbetalingUtbetaltRiver(

init {
River(rapidsConnection).apply {
precondition { it.requireValue("@event_name", "utbetaling_utbetalt") }
validate {
it.demandValue("@event_name", "utbetaling_utbetalt")
it.requireKey(
"fødselsnummer",
"@id",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ internal class UtbetalingUtenUtbetalingRiver(

init {
River(rapidsConnection).apply {
precondition { it.requireValue("@event_name", "utbetaling_uten_utbetaling") }
validate {
it.demandValue("@event_name", "utbetaling_uten_utbetaling")
it.requireKey(
"fødselsnummer",
"@id",
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/no/nav/helse/sporbar/VedtakFattetRiver.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ internal class VedtakFattetRiver(

init {
River(rapidsConnection).apply {
precondition { it.requireValue("@event_name", "vedtak_fattet") }
validate {
it.demandValue("@event_name", "vedtak_fattet")
it.requireKey(
"fødselsnummer",
"@id",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ internal class VedtaksperiodeAnnullertRiver(

init {
River(rapidsConnection).apply {
precondition { it.requireValue("@event_name", "vedtaksperiode_annullert") }
validate {
it.demandValue("@event_name", "vedtaksperiode_annullert")
it.requireKey(
"fødselsnummer",
"@id",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ internal class BehandlingForkastetRiver(rapid: RapidsConnection, private val sis

init {
River(rapid).apply {
precondition { it.requireValue("@event_name", "behandling_forkastet") }
validate {
it.demandValue("@event_name", "behandling_forkastet")
it.requireKey("vedtaksperiodeId", "behandlingId")
it.require("@opprettet", JsonNode::asLocalDateTime)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ internal class BehandlingLukketRiver(rapid: RapidsConnection, private val sisPub

init {
River(rapid).apply {
precondition { it.requireValue("@event_name", "behandling_lukket") }
validate {
it.demandValue("@event_name", "behandling_lukket")
it.requireKey("vedtaksperiodeId", "behandlingId")
it.require("@opprettet", JsonNode::asLocalDateTime)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ internal class BehandlingOpprettetRiver(rapid: RapidsConnection, private val dok

init {
River(rapid).apply {
precondition { it.requireValue("@event_name", "behandling_opprettet") }
validate {
it.demandValue("@event_name", "behandling_opprettet")
it.requireKey("vedtaksperiodeId", "behandlingId", "søknadIder")
it.require("@opprettet", JsonNode::asLocalDateTime)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ internal class VedtaksperiodeVenterRiver(rapid: RapidsConnection, private val do

init {
River(rapid).apply {
precondition {
it.requireValue("@event_name", "vedtaksperiode_venter")
it.requireAny("venterPå.venteårsak.hva", listOf("SØKNAD", "INNTEKTSMELDING", "GODKJENNING"))
}
validate {
it.demandValue("@event_name", "vedtaksperiode_venter")
it.demandAny("venterPå.venteårsak.hva", listOf("SØKNAD", "INNTEKTSMELDING", "GODKJENNING"))
it.requireKey("vedtaksperiodeId", "behandlingId", "organisasjonsnummer", "venterPå.vedtaksperiodeId", "venterPå.organisasjonsnummer", "hendelser")
it.require("@opprettet", JsonNode::asLocalDateTime)
}
Expand Down

0 comments on commit a3238e0

Please sign in to comment.