Skip to content

Commit df43688

Browse files
authored
Sett inntektsmelding-felter vi vet ikke er null som required (#547)
### **Behov / Bakgrunn** Vi ønsker å være tydelige på hvilke felter som kan være null hvilke som ikke er det. ### **Løsning** Etter undersøking i databasen setter vi de feltene som aldri er null som required.
1 parent dcb7aac commit df43688

File tree

6 files changed

+81
-51
lines changed

6 files changed

+81
-51
lines changed

innsyn/src/main/java/no/nav/k9/innsyn/inntektsmelding/Gradering.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
package no.nav.k9.innsyn.inntektsmelding;
22

33
import com.fasterxml.jackson.annotation.JsonProperty;
4+
45
import jakarta.validation.Valid;
56
import jakarta.validation.constraints.NotNull;
67
import no.nav.k9.søknad.felles.type.Periode;
78

89
public record Gradering(
910
@Valid
1011
@NotNull
11-
@JsonProperty(value = "periode")
12+
@JsonProperty(value = "periode", required = true)
1213
Periode periode,
1314

1415
@Valid
1516
@NotNull
16-
@JsonProperty(value = "arbeidstidProsent")
17+
@JsonProperty(value = "arbeidstidProsent", required = true)
1718
Stillingsprosent arbeidstidProsent
1819
) implements Comparable<Gradering> {
1920

innsyn/src/main/java/no/nav/k9/innsyn/inntektsmelding/Inntektsmelding.java

Lines changed: 53 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,99 +1,114 @@
11
package no.nav.k9.innsyn.inntektsmelding;
22

3+
import java.time.LocalDate;
4+
import java.time.LocalDateTime;
5+
import java.util.List;
6+
37
import com.fasterxml.jackson.annotation.JsonProperty;
48
import com.fasterxml.jackson.annotation.JsonTypeName;
9+
510
import jakarta.validation.Valid;
11+
import jakarta.validation.constraints.NotNull;
612
import no.nav.k9.innsyn.InnsynHendelseData;
713
import no.nav.k9.innsyn.sak.AktørId;
814
import no.nav.k9.innsyn.sak.FagsakYtelseType;
915
import no.nav.k9.innsyn.sak.Saksnummer;
1016

11-
import java.time.LocalDate;
12-
import java.time.LocalDateTime;
13-
import java.util.List;
14-
1517
@JsonTypeName(InnsynHendelseData.INNTEKTSMELDING)
1618
public record Inntektsmelding(
1719

1820
@JsonProperty(value = "søkerAktørId", required = true)
21+
@NotNull
1922
AktørId søkerAktørId,
2023

2124
@JsonProperty(value = "fagsakYtelseType", required = true)
25+
@NotNull
2226
FagsakYtelseType fagsakYtelseType,
2327

2428
@JsonProperty(value = "status", required = true)
29+
@NotNull
2530
InntektsmeldingStatus status,
2631

2732
@JsonProperty(value = "saksnummer", required = true)
33+
@NotNull
2834
@Valid
2935
Saksnummer saksnummer,
3036

31-
@JsonProperty(value = "graderinger")
32-
@Valid
33-
List<Gradering> graderinger,
34-
35-
@JsonProperty(value = "naturalYtelser")
36-
@Valid
37-
List<NaturalYtelse> naturalYtelser,
37+
@JsonProperty(value = "innsendingstidspunkt", required = true)
38+
@NotNull
39+
LocalDateTime innsendingstidspunkt,
3840

39-
@JsonProperty(value = "utsettelsePerioder")
40-
@Valid
41-
List<UtsettelsePeriode> utsettelsePerioder,
41+
@JsonProperty(value = "kildesystem", required = true)
42+
@NotNull
43+
String kildesystem,
4244

4345
@JsonProperty(value = "arbeidsgiver", required = true)
46+
@NotNull
4447
@Valid
4548
Arbeidsgiver arbeidsgiver,
4649

47-
@JsonProperty(value = "startDatoPermisjon")
48-
LocalDate startDatoPermisjon,
49-
50-
@JsonProperty(value = "oppgittFravær")
51-
@Valid
52-
List<PeriodeAndel> oppgittFravær,
53-
54-
@JsonProperty(value = "nærRelasjon")
50+
@JsonProperty(value = "nærRelasjon", required = true)
51+
@NotNull
5552
boolean nærRelasjon,
5653

5754
@JsonProperty(value = "journalpostId", required = true)
55+
@NotNull
5856
@Valid
5957
JournalpostId journalpostId,
6058

6159
@JsonProperty(value = "mottattDato", required = true)
60+
@NotNull
6261
LocalDate mottattDato,
6362

6463
@JsonProperty(value = "inntektBeløp", required = true)
64+
@NotNull
6565
@Valid
6666
Beløp inntektBeløp,
6767

68+
@JsonProperty(value = "innsendingsårsak", required = true)
69+
@NotNull
70+
InntektsmeldingInnsendingsårsak innsendingsårsak,
71+
72+
@JsonProperty(value = "erstattetAv", required = true)
73+
@NotNull
74+
@Valid
75+
List<JournalpostId> erstattetAv,
76+
77+
// Nesten ingen inntektsmeldinger har graderinger. Kun 10 i hele prod databasen per 4.10.25
78+
@JsonProperty(value = "graderinger")
79+
@Valid
80+
List<Gradering> graderinger,
81+
82+
@JsonProperty(value = "naturalYtelser")
83+
@Valid
84+
List<NaturalYtelse> naturalYtelser,
85+
86+
@JsonProperty(value = "utsettelsePerioder")
87+
@Valid
88+
List<UtsettelsePeriode> utsettelsePerioder,
89+
90+
@JsonProperty(value = "startDatoPermisjon")
91+
LocalDate startDatoPermisjon,
92+
93+
@JsonProperty(value = "oppgittFravær")
94+
@Valid
95+
List<PeriodeAndel> oppgittFravær,
96+
6897
@JsonProperty(value = "refusjonBeløpPerMnd")
6998
@Valid
7099
Beløp refusjonBeløpPerMnd,
71100

72101
@JsonProperty(value = "refusjonOpphører")
73102
LocalDate refusjonOpphører,
74103

75-
@JsonProperty(value = "innsendingstidspunkt", required = true)
76-
LocalDateTime innsendingstidspunkt,
77-
78-
@JsonProperty(value = "kildesystem", required = true)
79-
String kildesystem,
80-
81104
@JsonProperty(value = "inntektsmeldingType")
82105
InntektsmeldingType inntektsmeldingType,
83106

84107
@JsonProperty(value = "endringerRefusjon")
85108
@Valid
86-
List<Refusjon> endringerRefusjon,
109+
List<Refusjon> endringerRefusjon
87110

88-
@JsonProperty(value = "innsendingsårsak")
89-
InntektsmeldingInnsendingsårsak innsendingsårsak,
90-
91-
@JsonProperty(value = "imYtelseType")
92-
FagsakYtelseType imYtelseType,
93-
94-
@JsonProperty(value = "erstattetAv")
95-
@Valid
96-
List<JournalpostId> erstattetAv
111+
/* ytelseType på inntektsmeldingen er alltid null fordi den ikke lagres i k9-abakus.*/
97112

98113
) implements InnsynHendelseData {
99114
}
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package no.nav.k9.innsyn.inntektsmelding;
22

33
import com.fasterxml.jackson.annotation.JsonProperty;
4+
45
import jakarta.validation.Valid;
6+
import jakarta.validation.constraints.NotNull;
57
import no.nav.k9.søknad.felles.type.Periode;
68

79
public record NaturalYtelse(
@@ -10,11 +12,13 @@ public record NaturalYtelse(
1012
Periode periode,
1113

1214
@Valid
13-
@JsonProperty(value = "beloepPerMnd")
15+
@JsonProperty(value = "beloepPerMnd", required = true)
16+
@NotNull
1417
Beløp beloepPerMnd,
1518

1619
@Valid
17-
@JsonProperty(value = "type")
20+
@JsonProperty(value = "type", required = true)
21+
@NotNull
1822
NaturalYtelseType type
1923
) {
2024
}

innsyn/src/main/java/no/nav/k9/innsyn/inntektsmelding/PeriodeAndel.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
package no.nav.k9.innsyn.inntektsmelding;
22

3+
import java.time.Duration;
4+
35
import com.fasterxml.jackson.annotation.JsonProperty;
6+
47
import jakarta.validation.Valid;
8+
import jakarta.validation.constraints.NotNull;
59
import no.nav.k9.søknad.felles.type.Periode;
610

7-
import java.time.Duration;
8-
911
public record PeriodeAndel(
1012

11-
@JsonProperty(value = "periode")
13+
@JsonProperty(value = "periode", required = true)
14+
@NotNull
1215
@Valid
1316
Periode periode,
1417

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
package no.nav.k9.innsyn.inntektsmelding;
22

3+
import java.time.LocalDate;
4+
35
import com.fasterxml.jackson.annotation.JsonProperty;
4-
import jakarta.validation.Valid;
56

6-
import java.time.LocalDate;
7+
import jakarta.validation.Valid;
8+
import jakarta.validation.constraints.NotNull;
79

810
public record Refusjon(
9-
@JsonProperty(value = "refusjonsbeløpMnd")
11+
@JsonProperty(value = "refusjonsbeløpMnd", required = true)
12+
@NotNull
1013
@Valid
1114
Beløp refusjonsbeløpMnd,
1215

13-
@JsonProperty(value = "fom")
16+
@JsonProperty(value = "fom", required = true)
17+
@NotNull
1418
LocalDate fom
1519
) {
1620
}
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
package no.nav.k9.innsyn.inntektsmelding;
22

33
import com.fasterxml.jackson.annotation.JsonProperty;
4+
45
import jakarta.validation.Valid;
56
import jakarta.validation.constraints.NotNull;
67
import no.nav.k9.søknad.felles.type.Periode;
78

89
public record UtsettelsePeriode(
10+
@JsonProperty(value = "periode", required = true)
911
@Valid
10-
@JsonProperty(value = "periode")
12+
@NotNull
1113
Periode periode,
1214

15+
@JsonProperty(value = "årsak", required = true)
1316
@Valid
14-
@JsonProperty(value = "årsak")
17+
@NotNull
1518
UtsettelseÅrsak årsak
1619
) {
1720
}

0 commit comments

Comments
 (0)