Skip to content

Commit

Permalink
Feature/endringsmelding frontend refaktor (#3465)
Browse files Browse the repository at this point in the history
* Stor refaktorering av endringsmelding-frontend, skrevet oss vekk fra redux til fordel for useState
* Endret en god del av oppsettet for henting av identer og logging i endringsmelding løypa
* Flyttet DollyLogbackEncoder til serlvet-core og reactive-core og endret til å peke på riktig sted for de respektive appene
* Fix av dolly frontend på visning av gammel type ident
* Fikset visning bug og unødvendig logging av empty warning liste i endringsmelding-frontend
* Skrur av sjekk i prod på EksisterPersonCommand etter diskusjon med Kristen, skal kunne opprette fødsels og dødsmelding på vaskede identer i prodlast miljøene
* Implement WebFilter and update error handling - Added WebFilter implementation to OpenApiConfig for path '/swagger' redirect. Updated error handling in FoedselsmeldingService and DoedsmeldingService to remove the check for "p" environment and modify the error message to better reflect the status of identity creation or deletion in the requested environment.
* Refactor DoedsmeldingService error handling -
Error handling in DoedsmeldingService has been refactored to improve clarity and accuracy. The check for "p" environment has been removed and the code has been streamlined to directly send a death cancellation message only if a person is marked as deceased. This helps to accurately reflect the status of identity handling in the requested environment

---------

Co-authored-by: kristenhaerum <[email protected]>
  • Loading branch information
stigus and krharum authored Apr 18, 2024
1 parent f4fbed3 commit 1333bec
Show file tree
Hide file tree
Showing 124 changed files with 1,008 additions and 1,509 deletions.
5 changes: 3 additions & 2 deletions apps/adresse-service/src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
<configuration>
<springProfile name="prod">
<appender name="stdout_json" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="net.logstash.logback.encoder.LogstashEncoder">
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
<layout class="no.nav.testnav.libs.servletcore.logging.DollyLogbackLayout"/>
<throwableConverter class="net.logstash.logback.stacktrace.ShortenedThrowableConverter">
<rootCauseFirst>true</rootCauseFirst>
<maxDepthPerThrowable>256</maxDepthPerThrowable>
Expand Down Expand Up @@ -35,5 +36,5 @@
<appender-ref ref="CONSOLE"/>
</root>
</springProfile>
<logger level="TRACE" name="no.nav.testnav.libs.servletcore.logging.LogRequestInterceptor" />
<logger level="TRACE" name="no.nav.testnav.libs.servletcore.logging.LogRequestInterceptor"/>
</configuration>
3 changes: 2 additions & 1 deletion apps/amelding-service/src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
<configuration>
<springProfile name="prod">
<appender name="stdout_json" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="net.logstash.logback.encoder.LogstashEncoder">
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
<layout class="no.nav.testnav.libs.reactivecore.logging.DollyLogbackLayout"/>
<throwableConverter class="net.logstash.logback.stacktrace.ShortenedThrowableConverter">
<rootCauseFirst>true</rootCauseFirst>
<maxDepthPerThrowable>256</maxDepthPerThrowable>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
<configuration>
<springProfile name="prod">
<appender name="stdout_json" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="net.logstash.logback.encoder.LogstashEncoder">
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
<layout class="no.nav.testnav.libs.reactivecore.logging.DollyLogbackLayout"/>
<throwableConverter class="net.logstash.logback.stacktrace.ShortenedThrowableConverter">
<rootCauseFirst>true</rootCauseFirst>
<maxDepthPerThrowable>256</maxDepthPerThrowable>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
<configuration>
<springProfile name="prod">
<appender name="stdout_json" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="net.logstash.logback.encoder.LogstashEncoder">
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
<layout class="no.nav.testnav.libs.servletcore.logging.DollyLogbackLayout"/>
<throwableConverter class="net.logstash.logback.stacktrace.ShortenedThrowableConverter">
<rootCauseFirst>true</rootCauseFirst>
<maxDepthPerThrowable>256</maxDepthPerThrowable>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
<configuration>
<springProfile name="prod">
<appender name="stdout_json" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="net.logstash.logback.encoder.LogstashEncoder">
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
<layout class="no.nav.testnav.libs.servletcore.logging.DollyLogbackLayout"/>
<throwableConverter class="net.logstash.logback.stacktrace.ShortenedThrowableConverter">
<rootCauseFirst>true</rootCauseFirst>
<maxDepthPerThrowable>256</maxDepthPerThrowable>
Expand Down
3 changes: 2 additions & 1 deletion apps/brreg-stub/src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
<configuration>
<springProfile name="prod">
<appender name="stdout_json" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="net.logstash.logback.encoder.LogstashEncoder">
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
<layout class="no.nav.testnav.libs.servletcore.logging.DollyLogbackLayout"/>
<throwableConverter class="net.logstash.logback.stacktrace.ShortenedThrowableConverter">
<rootCauseFirst>true</rootCauseFirst>
<maxDepthPerThrowable>256</maxDepthPerThrowable>
Expand Down
6 changes: 4 additions & 2 deletions apps/bruker-service/src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
<configuration>
<springProfile name="prod">
<appender name="stdout_json" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="net.logstash.logback.encoder.LogstashEncoder">
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
<layout class="no.nav.testnav.libs.reactivecore.logging.DollyLogbackLayout"/>
<throwableConverter class="net.logstash.logback.stacktrace.ShortenedThrowableConverter">
<rootCauseFirst>true</rootCauseFirst>
<maxDepthPerThrowable>256</maxDepthPerThrowable>
Expand All @@ -24,7 +25,8 @@

<springProfile name="dev">
<appender name="stdout_json" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="net.logstash.logback.encoder.LogstashEncoder">
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
<layout class="no.nav.testnav.libs.servletcore.logging.DollyLogbackLayout"/>
<throwableConverter class="net.logstash.logback.stacktrace.ShortenedThrowableConverter">
<rootCauseFirst>true</rootCauseFirst>
<maxDepthPerThrowable>256</maxDepthPerThrowable>
Expand Down
3 changes: 2 additions & 1 deletion apps/budpro-service/src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
<configuration>
<springProfile name="prod,dev">
<appender name="stdout_json" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="net.logstash.logback.encoder.LogstashEncoder">
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
<layout class="no.nav.testnav.libs.servletcore.logging.DollyLogbackLayout"/>
<throwableConverter class="net.logstash.logback.stacktrace.ShortenedThrowableConverter">
<rootCauseFirst>true</rootCauseFirst>
<maxDepthPerThrowable>256</maxDepthPerThrowable>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import no.nav.dolly.bestilling.ConsumerStatus;
import no.nav.dolly.bestilling.tpsmessagingservice.command.EgenansattDeleteCommand;
import no.nav.dolly.bestilling.tpsmessagingservice.command.EgenansattPostCommand;
import no.nav.dolly.bestilling.tpsmessagingservice.command.PersonGetCommand;
import no.nav.dolly.bestilling.tpsmessagingservice.command.PersonHentCommand;
import no.nav.dolly.bestilling.tpsmessagingservice.command.TpsMessagingPostCommand;
import no.nav.dolly.config.Consumers;
import no.nav.dolly.metrics.Timed;
Expand Down Expand Up @@ -52,7 +52,7 @@ public TpsMessagingConsumer(
.build();
}

@Timed(name = "providers", tags = {"operation", "tps_messaging_createUtenlandskBankkonto"})
@Timed(name = "providers", tags = { "operation", "tps_messaging_createUtenlandskBankkonto" })
public Flux<TpsMeldingResponseDTO> sendUtenlandskBankkontoRequest(String ident, List<String> miljoer,
BankkontonrUtlandDTO body) {

Expand All @@ -61,42 +61,42 @@ public Flux<TpsMeldingResponseDTO> sendUtenlandskBankkontoRequest(String ident,
new TpsMessagingPostCommand(webClient, ident, miljoer, body, UTENLANDSK_BANKKONTO_URL, token.getTokenValue()).call());
}

@Timed(name = "providers", tags = {"operation", "tps_messaging_createNorskBankkonto"})
@Timed(name = "providers", tags = { "operation", "tps_messaging_createNorskBankkonto" })
public Flux<TpsMeldingResponseDTO> sendNorskBankkontoRequest(String ident, List<String> miljoer, BankkontonrNorskDTO body) {

return tokenService.exchange(serverProperties)
.flatMapMany(token ->
new TpsMessagingPostCommand(webClient, ident, miljoer, body, NORSK_BANKKONTO_URL, token.getTokenValue()).call());
}

@Timed(name = "providers", tags = {"operation", "tps_messaging_createSkjerming"})
@Timed(name = "providers", tags = { "operation", "tps_messaging_createSkjerming" })
public Flux<TpsMeldingResponseDTO> sendEgenansattRequest(String ident, List<String> miljoer, LocalDate fraOgMed) {

return tokenService.exchange(serverProperties)
.flatMapMany(token ->
new EgenansattPostCommand(webClient, ident, miljoer, fraOgMed, token.getTokenValue()).call());
}

@Timed(name = "providers", tags = {"operation", "tps_messaging_deleteSkjerming"})
@Timed(name = "providers", tags = { "operation", "tps_messaging_deleteSkjerming" })
public Flux<TpsMeldingResponseDTO> deleteEgenansattRequest(String ident, List<String> miljoer) {

return tokenService.exchange(serverProperties)
.flatMapMany(token -> new EgenansattDeleteCommand(webClient, ident, miljoer, token.getTokenValue()).call());
}

@Timed(name = "providers", tags = {"operation", "tps_messaging_createSpraakkode"})
@Timed(name = "providers", tags = { "operation", "tps_messaging_createSpraakkode" })
public Flux<TpsMeldingResponseDTO> sendSpraakkodeRequest(String ident, List<String> miljoer, SpraakDTO body) {

return tokenService.exchange(serverProperties)
.flatMapMany(token ->
new TpsMessagingPostCommand(webClient, ident, miljoer, body, SPRAAKKODE_URL, token.getTokenValue()).call());
}

@Timed(name = "providers", tags = {"operation", "tps_messaging_getPerson"})
@Timed(name = "providers", tags = { "operation", "tps_messaging_getPerson" })
public Flux<PersonMiljoeDTO> getPerson(String ident, List<String> miljoer) {

return tokenService.exchange(serverProperties)
.flatMapMany(token -> new PersonGetCommand(webClient, ident, miljoer, token.getTokenValue()).call());
.flatMapMany(token -> new PersonHentCommand(webClient, ident, miljoer, token.getTokenValue()).call());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@

@RequiredArgsConstructor
@Slf4j
public class PersonGetCommand implements Callable<Flux<PersonMiljoeDTO>> {
public class PersonHentCommand implements Callable<Flux<PersonMiljoeDTO>> {

private static final String MILJOER_PARAM = "miljoer";
private static final String PERSONER_URL = "/api/v1/personer/{ident}";
private static final String PERSONER_URL = "/api/v2/personer/ident";

private final WebClient webClient;
private final String ident;
Expand All @@ -27,11 +27,12 @@ public class PersonGetCommand implements Callable<Flux<PersonMiljoeDTO>> {
@Override
public Flux<PersonMiljoeDTO> call() {

return webClient.get()
return webClient.post()
.uri(uriBuilder -> uriBuilder
.path(PERSONER_URL)
.queryParam(MILJOER_PARAM, miljoer)
.build(ident))
.build())
.bodyValue(ident)
.header(HttpHeaders.AUTHORIZATION, "Bearer " + token)
.retrieve()
.bodyToFlux(PersonMiljoeDTO.class)
Expand Down
15 changes: 8 additions & 7 deletions apps/dolly-backend/src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
<configuration>
<springProfile name="prod,dev">
<appender name="stdout_json" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="net.logstash.logback.encoder.LogstashEncoder">
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
<layout class="no.nav.testnav.libs.servletcore.logging.DollyLogbackLayout"/>
<throwableConverter class="net.logstash.logback.stacktrace.ShortenedThrowableConverter">
<rootCauseFirst>true</rootCauseFirst>
<maxDepthPerThrowable>256</maxDepthPerThrowable>
Expand Down Expand Up @@ -37,10 +38,10 @@
</root>
</springProfile>

<logger level="TRACE" name="no.nav.testnav.libs.reactivecore.filter.RequestLogger" />
<logger level="TRACE" name="no.nav.testnav.libs.servletcore.logging.LogRequestInterceptor" />
<logger level="TRACE" name="org.jetbrains.nativecerts" />
<logger level="TRACE" name="com.intellij.util.net.ssl" />
<logger level="ERROR" name="reactor.netty.transport.TransportConnector" />
<logger level="DEBUG" name="reactor.netty.http.client.HttpClient" />
<logger level="TRACE" name="no.nav.testnav.libs.reactivecore.filter.RequestLogger"/>
<logger level="TRACE" name="no.nav.testnav.libs.servletcore.logging.LogRequestInterceptor"/>
<logger level="TRACE" name="org.jetbrains.nativecerts"/>
<logger level="TRACE" name="com.intellij.util.net.ssl"/>
<logger level="ERROR" name="reactor.netty.transport.TransportConnector"/>
<logger level="DEBUG" name="reactor.netty.http.client.HttpClient"/>
</configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,4 @@ private Function<PredicateSpec, Buildable<Route>> createRoute(String segment, St
.filters(filter, addUserJwtHeaderFilter())
).uri(host);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ export default function BestillingSammendrag({ bestilling }) {
sistOppdatert: bestilling.sistOppdatert,
opprettetFraId: bestilling.opprettetFraId,
opprettetFraGruppeId: bestilling.opprettetFraGruppeId,
navSyntetiskIdent: bestilling.bestilling.pdldata?.opprettNyPerson?.syntetisk,
beskrivelse: bestilling.bestilling.beskrivelse,
navSyntetiskIdent: bestilling?.bestilling?.pdldata?.opprettNyPerson?.syntetisk,
beskrivelse: bestilling?.bestilling?.beskrivelse,
}}
header="Bestillingskriterier"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export const ArbeidsforholdForm = ({

const aaregBestillinger = bestillinger
?.filter((bestilling) => bestilling?.data?.aareg)
?.flatMap((bestilling) => bestilling.data.aareg)
?.flatMap((bestilling) => bestilling.data?.aareg)
?.filter((bestilling) => _.isEmpty(bestilling?.amelding))

return _.uniqWith(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,10 @@ const ingenOverlappFraTildato = (tildato, values) => {

if (values.tidligereBestillinger) {
const arenaBestillinger = values.tidligereBestillinger.filter((bestilling) =>
bestilling.data.hasOwnProperty('arenaforvalter'),
bestilling.data?.hasOwnProperty('arenaforvalter'),
)
for (let bestilling of arenaBestillinger) {
let arenaInfo = bestilling.data.arenaforvalter
let arenaInfo = bestilling.data?.arenaforvalter
for (let key of ikkeOverlappendeVedtak) {
if (arenaInfo[key]?.length > 0) {
const fraDatoBestilling = arenaInfo[key]?.[0]?.fraDato
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ InntektsmeldingVisning.filterValues = (bestillinger: Array<Bestilling>, ident: s

return bestillinger.filter(
(bestilling: any) =>
bestilling.data.inntektsmelding &&
!tomBestilling(bestilling.data.inntektsmelding.inntekter) &&
bestilling.data?.inntektsmelding &&
!tomBestilling(bestilling.data?.inntektsmelding.inntekter) &&
erGyldig(bestilling.id, 'INNTKMELD', ident),
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,6 @@ SykemeldingVisning.filterValues = (bestillinger: Array<Sykemelding>, ident: stri

return bestillinger.filter(
(bestilling: any) =>
bestilling.data.sykemelding && erGyldig(bestilling.id, 'SYKEMELDING', ident),
bestilling.data?.sykemelding && erGyldig(bestilling.id, 'SYKEMELDING', ident),
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ export default ({
<KrrVisning data={krrstub} loading={loading.krrstub} />
<MedlVisning data={medl} loading={loadingMedl} />
<UdiVisning
data={UdiVisning.filterValues(udistub, bestilling?.bestilling.udistub)}
data={UdiVisning.filterValues(udistub, bestilling?.bestilling?.udistub)}
loading={loadingUdistub}
/>
<DokarkivVisning
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
import Request from '@/service/services/Request'

const TPS_MESSAGING_URL = `/testnav-tps-messaging-service/api/v1/personer`
const TPS_MESSAGING_URL_V1 = `/testnav-tps-messaging-service/api/v1/personer`
const TPS_MESSAGING_URL_V2 = `/testnav-tps-messaging-service/api/v2/personer`

const getTpsMessagingUrl = (ident, miljoe) => `${TPS_MESSAGING_URL}/${ident}?miljoer=${miljoe}`
const getTpsMessagingUrlAllEnvs = (ident) => `${TPS_MESSAGING_URL}/${ident}`
const getTpsMessagingUrl_V2 = (miljoe) => `${TPS_MESSAGING_URL_V2}/ident?miljoer=${miljoe}`
const getTpsMessagingUrlAllEnvs_V2 = () => `${TPS_MESSAGING_URL_V2}/ident`

export default {
getTpsPersonInfo(ident, miljoe) {
return Request.get(getTpsMessagingUrl(ident, miljoe))
return Request.post(getTpsMessagingUrl_V2(miljoe), ident)
},
getTpsPersonInfoAllEnvs(ident) {
return Request.get(getTpsMessagingUrlAllEnvs(ident))
return Request.post(getTpsMessagingUrlAllEnvs_V2(), ident)
},
deleteBankkontoNorsk(ident) {
return Request.delete(`${TPS_MESSAGING_URL}/${ident}/bankkonto-norsk`)
return Request.delete(`${TPS_MESSAGING_URL_V1}/${ident}/bankkonto-norsk`)
},
deleteBankkontoUtenlandsk(ident) {
return Request.delete(`${TPS_MESSAGING_URL}/${ident}/bankkonto-utenlandsk`)
return Request.delete(`${TPS_MESSAGING_URL_V1}/${ident}/bankkonto-utenlandsk`)
},
}
Loading

0 comments on commit 1333bec

Please sign in to comment.