diff --git a/.github/workflows/common.integration-test.yml b/.github/workflows/common.integration-test.yml index 1e60dd7682d..8246c29c8d2 100644 --- a/.github/workflows/common.integration-test.yml +++ b/.github/workflows/common.integration-test.yml @@ -37,7 +37,7 @@ jobs: run: ./gradlew assemble --scan - name: "Start docker containers" run: | - JWK=$(cat ./mocks/jwk.json) docker-compose up -d --build + JWK=$(cat ./mocks/jwk.json) docker compose up --build --detach - name: "Health check" timeout-minutes: 5 run: | @@ -52,4 +52,4 @@ jobs: run: ./gradlew iTest --scan - name: "Stop docker containers" run: | - docker-compose down -v --remove-orphans \ No newline at end of file + docker compose down --remove-orphans --volumes \ No newline at end of file diff --git a/README.md b/README.md index 8e7f3c98b8d..5ab74e250c9 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ Eller kjør: Kjør kommandoen: ``` -JWK=$(cat ./mocks/jwk.json) docker-compose up --build +JWK=$(cat ./mocks/jwk.json) docker compose up --build ``` Deretter kan itegrasjonstester kjøres med kommandoen: diff --git a/apps/app-tilgang-analyse-service/build.gradle b/apps/app-tilgang-analyse-service/build.gradle index 88d3ffe411e..dec83579f53 100644 --- a/apps/app-tilgang-analyse-service/build.gradle +++ b/apps/app-tilgang-analyse-service/build.gradle @@ -23,6 +23,7 @@ dependencies { implementation 'io.r2dbc:r2dbc-h2' implementation 'org.postgresql:r2dbc-postgresql' implementation 'org.flywaydb:flyway-core' + implementation 'org.flywaydb:flyway-database-postgresql' implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml' implementation "org.springdoc:springdoc-openapi-starter-webflux-ui:$versions.springdoc" diff --git a/apps/app-tilgang-analyse-service/config.yml b/apps/app-tilgang-analyse-service/config.yml index 6af65eac8e0..100af1c8ef6 100644 --- a/apps/app-tilgang-analyse-service/config.yml +++ b/apps/app-tilgang-analyse-service/config.yml @@ -26,6 +26,7 @@ spec: gcp: sqlInstances: - type: POSTGRES_12 + tier: db-custom-1-3840 databases: - name: testnav-app-tilgang-analyse-service-db liveness: diff --git a/apps/brreg-stub/build.gradle b/apps/brreg-stub/build.gradle index 48e8a1d39ae..6b27b6d7857 100644 --- a/apps/brreg-stub/build.gradle +++ b/apps/brreg-stub/build.gradle @@ -44,6 +44,7 @@ dependencies { implementation 'com.zaxxer:HikariCP' implementation 'org.flywaydb:flyway-core' + implementation 'org.flywaydb:flyway-database-postgresql' implementation 'com.h2database:h2' implementation 'wsdl4j:wsdl4j' diff --git a/apps/bruker-service/build.gradle b/apps/bruker-service/build.gradle index d2d3a9c73f0..d4f5e8f8a73 100644 --- a/apps/bruker-service/build.gradle +++ b/apps/bruker-service/build.gradle @@ -41,6 +41,7 @@ dependencies { implementation 'io.r2dbc:r2dbc-h2' implementation 'org.postgresql:r2dbc-postgresql' implementation 'org.flywaydb:flyway-core' + implementation 'org.flywaydb:flyway-database-postgresql' runtimeOnly 'org.postgresql:postgresql' runtimeOnly 'com.h2database:h2' diff --git a/apps/bruker-service/config.test.yml b/apps/bruker-service/config.test.yml index 212ff54597d..453d3e269fe 100644 --- a/apps/bruker-service/config.test.yml +++ b/apps/bruker-service/config.test.yml @@ -49,6 +49,7 @@ spec: gcp: sqlInstances: - type: POSTGRES_12 + tier: db-custom-1-3840 databases: - name: testnav-bruker-service-dev-db resources: diff --git a/apps/bruker-service/config.yml b/apps/bruker-service/config.yml index 2c476c5550b..2480d21e648 100644 --- a/apps/bruker-service/config.yml +++ b/apps/bruker-service/config.yml @@ -45,6 +45,7 @@ spec: gcp: sqlInstances: - type: POSTGRES_12 + tier: db-custom-1-3840 databases: - name: testnav-bruker-service-db envFrom: diff --git a/apps/dolly-backend/build.gradle b/apps/dolly-backend/build.gradle index 2adde405cba..27bfb40bc72 100644 --- a/apps/dolly-backend/build.gradle +++ b/apps/dolly-backend/build.gradle @@ -45,6 +45,8 @@ dependencies { implementation 'org.postgresql:postgresql' implementation 'org.flywaydb:flyway-core' + implementation 'org.flywaydb:flyway-database-postgresql' + implementation "ma.glasnost.orika:orika-core:$versions.orika" implementation 'org.codehaus.jettison:jettison:1.5.4' implementation "org.apache.poi:poi:$versions.apachePoi" diff --git a/apps/dolly-backend/config.test.yml b/apps/dolly-backend/config.test.yml index 79877d0ed8b..8697769baf0 100644 --- a/apps/dolly-backend/config.test.yml +++ b/apps/dolly-backend/config.test.yml @@ -105,6 +105,7 @@ spec: gcp: sqlInstances: - type: POSTGRES_14 + tier: db-custom-1-3840 name: testnav-dolly-backend-dev databases: - name: testnav-dolly-backend-dev diff --git a/apps/dolly-backend/config.yml b/apps/dolly-backend/config.yml index 9cfaa4af76c..2ddfb8cb279 100644 --- a/apps/dolly-backend/config.yml +++ b/apps/dolly-backend/config.yml @@ -105,8 +105,8 @@ spec: gcp: sqlInstances: - type: POSTGRES_14 + tier: db-custom-2-7680 name: testnav-dolly-backend databases: - name: testnav-dolly-backend - tier: db-custom-2-3840 autoBackupHour: 2 diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/DollyBackendApplicationStarter.java b/apps/dolly-backend/src/main/java/no/nav/dolly/DollyBackendApplicationStarter.java index 6af8668f777..f0ef428e58d 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/DollyBackendApplicationStarter.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/DollyBackendApplicationStarter.java @@ -10,4 +10,4 @@ public static void main(String[] args) { SpringApplication.run(DollyBackendApplicationStarter.class, args); } -} \ No newline at end of file +} diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektsmelding/mapper/InntektsmeldingMappingStrategy.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektsmelding/mapper/InntektsmeldingMappingStrategy.java index e60fb258c34..024390f63a2 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektsmelding/mapper/InntektsmeldingMappingStrategy.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektsmelding/mapper/InntektsmeldingMappingStrategy.java @@ -67,8 +67,9 @@ public void mapAtoB(RsInntektsmelding rsInntektsmelding, public void mapAtoB(RsInntektsmelding.Inntektsmelding rsInntektsmelding, RsInntektsmeldingRequest inntektsmelding, MappingContext context) { - inntektsmelding.setAarsakTilInnsending( - nullcheckSetDefaultValue(inntektsmelding.getAarsakTilInnsending(), AarsakInnsendingKodeListe.NY)); + inntektsmelding.setAarsakTilInnsending(nonNull(rsInntektsmelding.getAarsakTilInnsending()) ? + mapperFacade.map(rsInntektsmelding.getAarsakTilInnsending(), AarsakInnsendingKodeListe.class) : + AarsakInnsendingKodeListe.NY); if (nonNull(rsInntektsmelding.getArbeidsgiver())) { @@ -254,4 +255,4 @@ private static LocalDateTime toLocalDateTime(LocalDate localDate) { return nonNull(localDate) ? localDate.atStartOfDay() : null; } -} \ No newline at end of file +} diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/BestillingElasticRepository.java b/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/BestillingElasticRepository.java index be7b3bafaf1..6f43f867fb2 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/BestillingElasticRepository.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/BestillingElasticRepository.java @@ -2,9 +2,10 @@ import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; +import java.util.Collection; import java.util.List; public interface BestillingElasticRepository extends ElasticsearchRepository { - List getAllByIdenterIn(List ident); + List getAllByIdenterIn(Collection identer); } diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/service/OpenSearchService.java b/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/service/OpenSearchService.java index a051168a81d..9fb08af57f1 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/service/OpenSearchService.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/service/OpenSearchService.java @@ -22,6 +22,7 @@ import java.io.IOException; import java.util.Arrays; import java.util.Collection; +import java.util.Collections; import java.util.List; import static java.util.Objects.nonNull; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/mapper/strategy/TestgruppeMappingStrategy.java b/apps/dolly-backend/src/main/java/no/nav/dolly/mapper/strategy/TestgruppeMappingStrategy.java index ab8bd4c9d62..7361700298f 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/mapper/strategy/TestgruppeMappingStrategy.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/mapper/strategy/TestgruppeMappingStrategy.java @@ -9,13 +9,9 @@ import no.nav.dolly.domain.resultset.Tags; import no.nav.dolly.domain.resultset.entity.testgruppe.RsTestgruppe; import no.nav.dolly.mapper.MappingStrategy; -import no.nav.testnav.libs.servletsecurity.action.GetUserInfo; -import org.springframework.security.core.context.SecurityContext; -import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.stereotype.Component; import static java.util.Objects.nonNull; -import static no.nav.dolly.util.CurrentAuthentication.getUserId; import static org.apache.commons.lang3.BooleanUtils.isTrue; import static org.apache.commons.lang3.StringUtils.isNotBlank; @@ -23,17 +19,6 @@ @RequiredArgsConstructor public class TestgruppeMappingStrategy implements MappingStrategy { - private final GetUserInfo getUserInfo; - - private static String getBrukerId(Bruker bruker) { - - if (isNotBlank(bruker.getBrukerId())) { - return bruker.getBrukerId(); - } else { - return nonNull(bruker.getEidAv()) ? bruker.getEidAv().getBrukerId() : bruker.getNavIdent(); - } - } - @Override public void register(MapperFactory factory) { factory.classMap(Testgruppe.class, RsTestgruppe.class) @@ -41,17 +26,12 @@ public void register(MapperFactory factory) { @Override public void mapAtoB(Testgruppe testgruppe, RsTestgruppe rsTestgruppe, MappingContext context) { - var securityContext = (SecurityContext) context.getProperty("securityContext"); - if (nonNull(securityContext)) { - SecurityContextHolder.setContext(securityContext); - } - rsTestgruppe.setAntallIdenter(testgruppe.getTestidenter().size()); rsTestgruppe.setAntallIBruk((int) testgruppe.getTestidenter().stream() .filter(ident -> isTrue(ident.getIBruk())) .count()); rsTestgruppe.setFavorittIGruppen(!testgruppe.getFavorisertAv().isEmpty()); - rsTestgruppe.setErEierAvGruppe(getUserId(getUserInfo).equals(getBrukerId(testgruppe.getOpprettetAv()))); + rsTestgruppe.setErEierAvGruppe(nonNull(context.getProperty("brukerId")) && (context.getProperty("brukerId")).equals(getBrukerId(testgruppe.getOpprettetAv()))); rsTestgruppe.setErLaast(isTrue(rsTestgruppe.getErLaast())); rsTestgruppe.setTags(testgruppe.getTags().stream() .filter(tag -> Tags.DOLLY != tag) @@ -62,4 +42,13 @@ public void mapAtoB(Testgruppe testgruppe, RsTestgruppe rsTestgruppe, MappingCon .byDefault() .register(); } + + private static String getBrukerId(Bruker bruker) { + + if (isNotBlank(bruker.getBrukerId())) { + return bruker.getBrukerId(); + } else { + return nonNull(bruker.getEidAv()) ? bruker.getEidAv().getBrukerId() : bruker.getNavIdent(); + } + } } \ No newline at end of file diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/provider/api/TestgruppeController.java b/apps/dolly-backend/src/main/java/no/nav/dolly/provider/api/TestgruppeController.java index da740694bae..59eae5e60ff 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/provider/api/TestgruppeController.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/provider/api/TestgruppeController.java @@ -93,7 +93,7 @@ public RsTestgruppe oppdaterTestgruppeLaas(@PathVariable("gruppeId") Long gruppe return mapperFacade.map(gruppe, RsTestgruppe.class); } - @CacheEvict(value = {CACHE_GRUPPE}, allEntries = true) + @CacheEvict(value = { CACHE_GRUPPE }, allEntries = true) @PostMapping @Transactional @ResponseStatus(HttpStatus.CREATED) @@ -155,7 +155,7 @@ public void slettgruppe(@PathVariable("gruppeId") Long gruppeId) { testgruppeService.deleteGruppeById(gruppeId); } - @CacheEvict(value = {CACHE_BESTILLING, CACHE_GRUPPE}, allEntries = true) + @CacheEvict(value = { CACHE_BESTILLING, CACHE_GRUPPE }, allEntries = true) @ResponseStatus(HttpStatus.CREATED) @PostMapping("/{gruppeId}/bestilling") @Operation(description = "Opprett berikede testpersoner basert på fødselsdato, kjønn og identtype") @@ -167,7 +167,7 @@ public RsBestillingStatus opprettIdentBestilling(@PathVariable("gruppeId") Long } @Operation(description = "Opprett berikede testpersoner basert på eskisterende identer") - @CacheEvict(value = {CACHE_BESTILLING, CACHE_GRUPPE}, allEntries = true) + @CacheEvict(value = { CACHE_BESTILLING, CACHE_GRUPPE }, allEntries = true) @ResponseStatus(HttpStatus.CREATED) @PostMapping("/{gruppeId}/bestilling/fraidenter") public RsBestillingStatus opprettIdentBestillingFraIdenter(@PathVariable("gruppeId") Long gruppeId, @RequestBody RsDollyBestillingFraIdenterRequest request) { @@ -179,7 +179,7 @@ public RsBestillingStatus opprettIdentBestillingFraIdenter(@PathVariable("gruppe } @Operation(description = "Importere testpersoner fra PDL og legg til berikning non-PDL artifacter") - @CacheEvict(value = {CACHE_BESTILLING, CACHE_GRUPPE}, allEntries = true) + @CacheEvict(value = { CACHE_BESTILLING, CACHE_GRUPPE }, allEntries = true) @ResponseStatus(HttpStatus.CREATED) @PostMapping("/{gruppeId}/bestilling/importfrapdl") public RsBestillingStatus importAvIdenterFraPdlBestilling(@PathVariable("gruppeId") Long gruppeId, @RequestBody RsDollyImportFraPdlRequest request) { @@ -191,7 +191,7 @@ public RsBestillingStatus importAvIdenterFraPdlBestilling(@PathVariable("gruppeI } @Operation(description = "Legg til berikning på alle i gruppe") - @CacheEvict(value = {CACHE_BESTILLING, CACHE_GRUPPE}, allEntries = true) + @CacheEvict(value = { CACHE_BESTILLING, CACHE_GRUPPE }, allEntries = true) @ResponseStatus(HttpStatus.OK) @PutMapping("/{gruppeId}/leggtilpaagruppe") public RsBestillingStatus endreGruppeLeggTil(@PathVariable("gruppeId") Long gruppeId, @RequestBody RsDollyBestillingLeggTilPaaGruppe request) { @@ -201,7 +201,7 @@ public RsBestillingStatus endreGruppeLeggTil(@PathVariable("gruppeId") Long grup return mapperFacade.map(bestilling, RsBestillingStatus.class); } - @CacheEvict(value = {CACHE_BESTILLING, CACHE_GRUPPE}, allEntries = true) + @CacheEvict(value = { CACHE_BESTILLING, CACHE_GRUPPE }, allEntries = true) @PutMapping("/{gruppeId}/gjenopprett") @Operation(description = "Gjenopprett testidenter tilhørende en gruppe med liste for tilhørende miljoer") public RsBestillingStatus gjenopprettBestilling(@PathVariable("gruppeId") Long gruppeId, @@ -212,7 +212,7 @@ public RsBestillingStatus gjenopprettBestilling(@PathVariable("gruppeId") Long g return mapperFacade.map(bestilling, RsBestillingStatus.class); } - @CacheEvict(value = {CACHE_GRUPPE, CACHE_BESTILLING}, allEntries = true) + @CacheEvict(value = { CACHE_GRUPPE, CACHE_BESTILLING }, allEntries = true) @Transactional @PutMapping(value = "/{gruppeId}/identer/{identer}") @Operation(description = "Flytt angitte identer til denne gruppe") diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/provider/api/TestpersonController.java b/apps/dolly-backend/src/main/java/no/nav/dolly/provider/api/TestpersonController.java index eb17aa4dd80..485607ef926 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/provider/api/TestpersonController.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/provider/api/TestpersonController.java @@ -5,9 +5,9 @@ import ma.glasnost.orika.MapperFacade; import no.nav.dolly.bestilling.service.GjenopprettIdentService; import no.nav.dolly.bestilling.service.OppdaterPersonService; -import no.nav.testnav.libs.dto.dolly.v1.FinnesDTO; import no.nav.dolly.domain.dto.TestidentDTO; import no.nav.dolly.domain.jpa.Bestilling; +import no.nav.dolly.domain.jpa.Bruker; import no.nav.dolly.domain.resultset.RsDollyUpdateRequest; import no.nav.dolly.domain.resultset.RsIdentBeskrivelse; import no.nav.dolly.domain.resultset.entity.bestilling.RsBestillingStatus; @@ -16,11 +16,14 @@ import no.nav.dolly.domain.testperson.IdentAttributesResponse; import no.nav.dolly.exceptions.NotFoundException; import no.nav.dolly.service.BestillingService; +import no.nav.dolly.service.BrukerService; import no.nav.dolly.service.IdentService; import no.nav.dolly.service.NavigasjonService; import no.nav.dolly.service.OrdreService; import no.nav.dolly.service.PersonService; import no.nav.dolly.service.TransaksjonMappingService; +import no.nav.testnav.libs.dto.dolly.v1.FinnesDTO; +import no.nav.testnav.libs.servletsecurity.action.GetUserInfo; import org.springframework.cache.annotation.CacheEvict; import org.springframework.http.HttpStatus; import org.springframework.transaction.annotation.Transactional; @@ -42,6 +45,7 @@ import static java.util.Objects.nonNull; import static no.nav.dolly.config.CachingConfig.CACHE_BESTILLING; import static no.nav.dolly.config.CachingConfig.CACHE_GRUPPE; +import static no.nav.dolly.util.CurrentAuthentication.getUserId; @RestController @RequiredArgsConstructor @@ -54,9 +58,11 @@ public class TestpersonController { private final OppdaterPersonService oppdaterPersonService; private final MapperFacade mapperFacade; private final IdentService identService; + private final BrukerService brukerService; private final PersonService personService; private final NavigasjonService navigasjonService; private final OrdreService ordreService; + private final GetUserInfo getUserInfo; @Operation(description = "Legge til egenskaper på person/endre person i TPS og øvrige systemer") @PutMapping("/{ident}/leggtilpaaperson") @@ -133,7 +139,8 @@ public void deleteTestident(@PathVariable String ident) { @GetMapping("/naviger/{ident}") public Mono navigerTilTestident(@PathVariable String ident) { - return navigasjonService.navigerTilIdent(ident); + Bruker bruker = brukerService.fetchBruker(getUserId(getUserInfo)); + return navigasjonService.navigerTilIdent(ident, bruker); } @Operation(description = "Sjekk om ønsket testperson finnes i Dolly") diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/service/BestillingService.java b/apps/dolly-backend/src/main/java/no/nav/dolly/service/BestillingService.java index 5164bcb4f63..576e0c57d2f 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/service/BestillingService.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/service/BestillingService.java @@ -30,7 +30,6 @@ import no.nav.dolly.repository.TestgruppeRepository; import no.nav.testnav.libs.servletsecurity.action.GetUserInfo; import org.apache.commons.lang3.StringUtils; -import org.hibernate.StaleStateException; import org.springframework.dao.DataIntegrityViolationException; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; @@ -52,6 +51,7 @@ import static java.lang.String.join; import static java.time.LocalDateTime.now; import static java.util.Collections.emptySet; +import static java.util.Objects.isNull; import static java.util.Objects.nonNull; import static java.util.stream.Collectors.toSet; import static no.nav.dolly.util.CurrentAuthentication.getUserId; @@ -140,7 +140,7 @@ public Page getBestillingerFromGruppeIdPaginert(Long gruppeId, Integ } @Transactional - @Retryable(StaleStateException.class) + @Retryable public Bestilling cancelBestilling(Long bestillingId) { var bestillingKontroll = bestillingKontrollRepository.findByBestillingId(bestillingId); @@ -214,19 +214,6 @@ public Bestilling saveBestilling(RsDollyUpdateRequest request, String ident) { return saveBestillingToDB(bestilling); } - private String filterAvailable(Collection environments) { - - var miljoer = miljoerConsumer.getMiljoer().block(); - return nonNull(environments) ? environments.stream() - .filter(miljoer::contains) - .collect(Collectors.joining(",")) : null; - } - - private String filterAvailable(String miljoer) { - - return isNotBlank(miljoer) ? filterAvailable(Arrays.asList(miljoer.split(","))) : null; - } - @Transactional public Bestilling saveBestilling(Long gruppeId, RsDollyBestilling request, Integer antall, List opprettFraIdenter, Boolean navSyntetiskIdent, String beskrivelse) { @@ -273,7 +260,6 @@ public Bestilling createBestillingForGjenopprettFraBestilling(Long bestillingId, .build()); } - @Transactional // Egen transaksjon på denne da bestillingId hentes opp igjen fra database i samme kallet public Bestilling createBestillingForGjenopprettFraIdent(String ident, Testgruppe testgruppe, List miljoer) { @@ -426,6 +412,28 @@ public String getBestKriterier(RsDollyBestilling request) { .build()); } + public List getProgressByBestillingId(Long bestillingId) { + + return bestillingProgressRepository.findByBestilling_Id(bestillingId); + } + + private String filterAvailable(Collection environments) { + + var miljoer = miljoerConsumer.getMiljoer().block(); + + if (isNull(miljoer)) { + return null; + } + return environments.stream() + .filter(miljoer::contains) + .collect(Collectors.joining(",")); + } + + private String filterAvailable(String miljoer) { + + return isNotBlank(miljoer) ? filterAvailable(Arrays.asList(miljoer.split(","))) : null; + } + private String wrapSearchString(String searchString) { return isNotBlank(searchString) ? "%%%s%%".formatted(searchString) : ""; } @@ -454,9 +462,4 @@ private static void fixAaregAbstractClassProblem(List aaregdata) { } }); } - - public List getProgressByBestillingId(Long bestillingId) { - - return bestillingProgressRepository.findByBestilling_Id(bestillingId); - } } \ No newline at end of file diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/service/MalBestillingService.java b/apps/dolly-backend/src/main/java/no/nav/dolly/service/MalBestillingService.java index 44bba21abcd..3e122762ffa 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/service/MalBestillingService.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/service/MalBestillingService.java @@ -3,6 +3,7 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import ma.glasnost.orika.MapperFacade; import no.nav.dolly.domain.jpa.Bestilling; import no.nav.dolly.domain.jpa.BestillingMal; @@ -38,6 +39,7 @@ import static no.nav.dolly.util.CurrentAuthentication.getUserId; @Service +@Slf4j @RequiredArgsConstructor public class MalBestillingService { @@ -69,6 +71,7 @@ public RsMalBestillingWrapper getMalBestillinger() { return RsMalBestilling.builder() .bestilling(objectMapper.readTree(bestillingMal.getBestKriterier())) .malNavn(bestillingMal.getMalNavn()) + .miljoer(bestillingMal.getMiljoer()) .id(bestillingMal.getId()) .bruker(mapperFacade.map(nonNull(bestillingMal.getBruker()) ? bestillingMal.getBruker() : @@ -88,6 +91,7 @@ public RsMalBestillingWrapper getMalBestillinger() { .toList()); return malBestillingWrapper; + } @Transactional(readOnly = true) @@ -105,6 +109,7 @@ public RsMalBestillingWrapper getMalbestillingByUser(String brukerId) { try { return RsMalBestilling.builder() .bestilling(objectMapper.readTree(bestillingMal.getBestKriterier())) + .miljoer(bestillingMal.getMiljoer()) .malNavn(bestillingMal.getMalNavn()) .id(bestillingMal.getId()) .bruker(mapperFacade.map(nonNull(bestillingMal.getBruker()) ? @@ -130,7 +135,7 @@ public void saveBestillingMal(Bestilling bestilling, String malNavn, Bruker bruk if (eksisterende.isEmpty()) { bestillingMalRepository.save(BestillingMal.builder() - .bestKriterier(bestilling.getBestKriterier()) + .bestKriterier(formatBestillingKriterier(bestilling.getBestKriterier())) .bruker(bruker) .malNavn(malNavn) .miljoer(bestilling.getMiljoer()) @@ -157,7 +162,7 @@ public RsMalBestilling saveBestillingMalFromBestillingId(Long bestillingId, Stri var maler = bestillingMalRepository.findByBrukerAndMalNavn(bruker, malNavn); if (maler.isEmpty()) { malbestilling = bestillingMalRepository.save(BestillingMal.builder() - .bestKriterier(bestilling.getBestKriterier()) + .bestKriterier(formatBestillingKriterier(bestilling.getBestKriterier())) .bruker(bruker) .malNavn(malNavn) .miljoer(bestilling.getMiljoer()) @@ -250,14 +255,6 @@ public static String getBruker(Bruker bruker) { }; } - private static Set toSet(String miljoer) { - - return StringUtils.isNotBlank(miljoer) ? - Arrays.stream(miljoer.split(",")) - .collect(Collectors.toSet()) : - Collections.emptySet(); - } - private String toJson(RsDollyUtvidetBestilling bestilling) { try { @@ -275,4 +272,16 @@ private RsDollyUtvidetBestilling fromJson(String json) { throw new ResponseStatusException(HttpStatus.INTERNAL_SERVER_ERROR, e.getMessage(), e); } } + + private String formatBestillingKriterier(String bestillingKriterier) { + return bestillingKriterier.replaceAll("fysiskDokument[^,]*+,", ""); + } + + private static Set toSet(String miljoer) { + + return StringUtils.isNotBlank(miljoer) ? + Arrays.stream(miljoer.split(",")) + .collect(Collectors.toSet()) : + Collections.emptySet(); + } } \ No newline at end of file diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/service/NavigasjonService.java b/apps/dolly-backend/src/main/java/no/nav/dolly/service/NavigasjonService.java index dce039152a5..f14625fe317 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/service/NavigasjonService.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/service/NavigasjonService.java @@ -7,6 +7,7 @@ import no.nav.dolly.bestilling.personservice.PersonServiceConsumer; import no.nav.dolly.domain.PdlPerson; import no.nav.dolly.domain.PdlPersonBolk; +import no.nav.dolly.domain.jpa.Bruker; import no.nav.dolly.domain.jpa.Testgruppe; import no.nav.dolly.domain.resultset.entity.testgruppe.RsTestgruppe; import no.nav.dolly.domain.resultset.entity.testident.RsWhereAmI; @@ -18,8 +19,6 @@ import no.nav.testnav.libs.data.pdlforvalter.v1.KontaktinformasjonForDoedsboDTO; import no.nav.testnav.libs.data.pdlforvalter.v1.SivilstandDTO; import no.nav.testnav.libs.data.pdlforvalter.v1.VergemaalDTO; -import org.springframework.security.core.context.SecurityContext; -import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import reactor.core.publisher.Flux; @@ -27,11 +26,11 @@ import java.util.List; import java.util.Objects; -import java.util.Optional; import java.util.function.Function; import java.util.stream.Stream; import static java.util.Objects.nonNull; +import static no.nav.dolly.util.IdentTypeUtil.isTenorIdent; @Service @RequiredArgsConstructor @@ -47,18 +46,16 @@ public class NavigasjonService { private final PdlDataConsumer pdlDataConsumer; @Transactional(readOnly = true) - public Mono navigerTilIdent(String ident) { + public Mono navigerTilIdent(String ident, Bruker bruker) { - var securityContext = SecurityContextHolder.getContext(); return Flux.merge(getPdlForvalterIdenter(ident), getPdlPersonIdenter(ident)) .filter(Objects::nonNull) + .filter(ident1 -> filterOnBrukertype(ident, bruker.getBrukertype())) .distinct() - .flatMap(ident1 -> Mono.just(identRepository.findByIdent(ident1)) - .filter(Optional::isPresent) - .map(Optional::get) + .flatMap(ident1 -> Mono.justOrEmpty(identRepository.findByIdent(ident1)) .map(testident -> RsWhereAmI.builder() - .gruppe(mapGruppe(testident.getTestgruppe(), securityContext)) + .gruppe(mapGruppe(testident.getTestgruppe(), bruker.getBrukerId())) .identHovedperson(testident.getIdent()) .identNavigerTil(ident) .sidetall(Math.floorDiv( @@ -69,16 +66,9 @@ public Mono navigerTilIdent(String ident) { .next(); } - private RsTestgruppe mapGruppe(Testgruppe testgruppe, SecurityContext securityContext) { - - var context = new MappingContext.Factory().getContext(); - context.setProperty("securityContext", securityContext); - return mapperFacade.map(testgruppe, RsTestgruppe.class, context); - } - public Mono navigerTilBestilling(Long bestillingId) { - return Mono.just(bestillingService.fetchBestillingById(bestillingId)) + return Mono.justOrEmpty(bestillingService.fetchBestillingById(bestillingId)) .map(bestilling -> RsWhereAmI.builder() .bestillingNavigerTil(bestillingId) .gruppe(mapperFacade.map(bestilling.getGruppe(), RsTestgruppe.class)) @@ -89,6 +79,20 @@ public Mono navigerTilBestilling(Long bestillingId) { .switchIfEmpty(Mono.error(() -> new NotFoundException(String.format(IKKE_FUNNET, bestillingId)))); } + private boolean filterOnBrukertype(String ident, Bruker.Brukertype brukertype) { + if (brukertype == Bruker.Brukertype.BANKID) { + return isTenorIdent(ident); + } + return true; + } + + private RsTestgruppe mapGruppe(Testgruppe testgruppe, String brukerId) { + + var context = new MappingContext.Factory().getContext(); + context.setProperty("brukerId", brukerId); + return mapperFacade.map(testgruppe, RsTestgruppe.class, context); + } + private Flux getPdlPersonIdenter(String ident) { return personServiceConsumer.getPdlPersoner(List.of(ident)) diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/util/IdentTypeUtil.java b/apps/dolly-backend/src/main/java/no/nav/dolly/util/IdentTypeUtil.java index 728458bcc11..802949460f7 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/util/IdentTypeUtil.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/util/IdentTypeUtil.java @@ -31,4 +31,16 @@ public static boolean isSyntetisk(String ident) { return isNotBlank(ident) && ident.length() == 11 && Integer.parseInt(ident.substring(2, 3)) >= 4; } + + public static boolean isDollyIdent(String ident) { + + return isSyntetisk(ident) && + ident.substring(2, 3).matches("[4,5]"); + } + + public static boolean isTenorIdent(String ident) { + + return isSyntetisk(ident) && + ident.substring(2, 3).matches("[8,9]"); + } } diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/util/TokenXUtil.java b/apps/dolly-backend/src/main/java/no/nav/dolly/util/TokenXUtil.java index fa6bab4e0d5..6a3d17bbafc 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/util/TokenXUtil.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/util/TokenXUtil.java @@ -43,7 +43,7 @@ public static UserInfo getBankidUser(GetUserInfo getUserInfo) { return getUserInfo.call() .orElse(null); } catch (NullPointerException e) { - log.info("Fant ikke BankID request"); + log.info("Fant ikke BankID brukerinfo"); return null; } } diff --git a/apps/dolly-backend/src/main/resources/application.yaml b/apps/dolly-backend/src/main/resources/application.yaml index f2bb53a8d5d..054493fae3c 100644 --- a/apps/dolly-backend/src/main/resources/application.yaml +++ b/apps/dolly-backend/src/main/resources/application.yaml @@ -48,6 +48,9 @@ spring: issuer-uri: ${AAD_ISSUER_URI}/v2.0 jwk-set-uri: ${AAD_ISSUER_URI}/discovery/v2.0/keys accepted-audience: ${azure.app.client.id}, api://${azure.app.client.id} + jackson: + parser: + include-source-in-location: true springdoc: swagger-ui: diff --git a/apps/dolly-backend/src/test/java/no/nav/dolly/mapper/strategy/TestgruppeMappingStrategyTest.java b/apps/dolly-backend/src/test/java/no/nav/dolly/mapper/strategy/TestgruppeMappingStrategyTest.java index 742699674c8..b24b18e177e 100644 --- a/apps/dolly-backend/src/test/java/no/nav/dolly/mapper/strategy/TestgruppeMappingStrategyTest.java +++ b/apps/dolly-backend/src/test/java/no/nav/dolly/mapper/strategy/TestgruppeMappingStrategyTest.java @@ -10,7 +10,6 @@ import no.nav.dolly.domain.resultset.entity.testident.RsTestident; import no.nav.dolly.elastic.BestillingElasticRepository; import no.nav.dolly.mapper.utils.MapperTestUtils; -import no.nav.testnav.libs.servletsecurity.action.GetUserInfo; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @@ -29,19 +28,16 @@ @SpringBootTest class TestgruppeMappingStrategyTest { + private final static String BRUKERID = "123"; @MockBean private BestillingElasticRepository bestillingElasticRepository; - @MockBean private ElasticsearchOperations elasticsearchOperations; - - private final static String BRUKERID = "123"; - private MapperFacade mapper; @BeforeEach public void setUpHappyPath() { - mapper = MapperTestUtils.createMapperFacadeForMappingStrategy(new TestgruppeMappingStrategy(new GetUserInfo("dummy"))); + mapper = MapperTestUtils.createMapperFacadeForMappingStrategy(new TestgruppeMappingStrategy()); MockedJwtAuthenticationTokenUtils.setJwtAuthenticationToken(); } diff --git a/apps/dolly-backend/src/test/java/no/nav/dolly/mapper/strategy/TestidentMappingTest.java b/apps/dolly-backend/src/test/java/no/nav/dolly/mapper/strategy/TestidentMappingTest.java index 50927b6d33a..30e50f657d5 100644 --- a/apps/dolly-backend/src/test/java/no/nav/dolly/mapper/strategy/TestidentMappingTest.java +++ b/apps/dolly-backend/src/test/java/no/nav/dolly/mapper/strategy/TestidentMappingTest.java @@ -7,7 +7,6 @@ import no.nav.dolly.domain.jpa.Testident; import no.nav.dolly.domain.resultset.entity.testident.RsTestident; import no.nav.dolly.mapper.utils.MapperTestUtils; -import no.nav.testnav.libs.servletsecurity.action.GetUserInfo; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -22,7 +21,7 @@ class TestidentMappingTest { @BeforeEach public void setUpHappyPath() { - mapper = MapperTestUtils.createMapperFacadeForMappingStrategy(new TestgruppeMappingStrategy(new GetUserInfo("dummy"))); + mapper = MapperTestUtils.createMapperFacadeForMappingStrategy(new TestgruppeMappingStrategy()); } @Test diff --git a/apps/dolly-backend/src/test/java/no/nav/dolly/provider/api/MalBestillingControllerTest.java b/apps/dolly-backend/src/test/java/no/nav/dolly/provider/api/MalBestillingControllerTest.java index 2879d3ae1ba..88b6f3758e5 100644 --- a/apps/dolly-backend/src/test/java/no/nav/dolly/provider/api/MalBestillingControllerTest.java +++ b/apps/dolly-backend/src/test/java/no/nav/dolly/provider/api/MalBestillingControllerTest.java @@ -1,5 +1,6 @@ package no.nav.dolly.provider.api; +import com.github.tomakehurst.wiremock.common.Json; import no.nav.dolly.MockedJwtAuthenticationTokenUtils; import no.nav.dolly.domain.jpa.Bestilling; import no.nav.dolly.domain.jpa.BestillingMal; @@ -30,13 +31,16 @@ import java.time.LocalDate; import java.time.LocalDateTime; +import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.empty; import static org.hamcrest.Matchers.hasSize; +import static org.hamcrest.Matchers.not; import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @@ -48,17 +52,41 @@ @AutoConfigureMockMvc(addFilters = false) class MalBestillingControllerTest { - @MockBean - @SuppressWarnings("unused") - private BestillingElasticRepository bestillingElasticRepository; - - @MockBean - @SuppressWarnings("unused") - private ElasticsearchOperations elasticsearchOperations; + private static final String MALNAVN = "test"; + private static final String NYTT_MALNAVN = "nyttMalnavn"; + private static final String BEST_KRITERIER = "{\"test\":true}"; + private static final String BEST_KRITERIER_FORMATERT = Json.write(""" + { + "pdldata": { + "opprettNyPerson": null, + "person": null + }, + "dokarkiv": { + "tittel": "Generell fullmakt", + "tema": "PEN", + "kanal": "NAV_NO", + "avsenderMottaker": { + "id": "123456789012", + "idType": "FNR", + "navn": "Lun overgang" + }, + "dokumenter": [ + { + "tittel": "dokument.pdf", + "brevkode": "BREV123", + "dokumentvarianter": [ + { + "filtype": "PDFA", + "fysiskDokument": "AWDHAWDIui23u21h", + "variantformat": "ARKIV" + } + ] + } + ] + } + } + """); - private final static String MALNAVN = "test"; - private final static String NYTT_MALNAVN = "nyttMalnavn"; - private final static String BEST_KRITERIER = "{\"test\":true}"; private static final Bruker DUMMY_EN = Bruker.builder() .brukerId("testbruker_en") .brukernavn("test_en") @@ -77,12 +105,17 @@ class MalBestillingControllerTest { .brukertype(Bruker.Brukertype.AZURE) .epost("epost@test_tre") .build(); + private static final String IDENT = "12345678912"; private static final String BESKRIVELSE = "Teste"; private static final String TESTGRUPPE = "Testgruppe"; private static final String UGYLDIG_BESTILLINGID = "999"; - - + @MockBean + @SuppressWarnings("unused") + private BestillingElasticRepository bestillingElasticRepository; + @MockBean + @SuppressWarnings("unused") + private ElasticsearchOperations elasticsearchOperations; @Autowired private MockMvc mockMvc; @Autowired @@ -117,10 +150,10 @@ public void afterEach() { void shouldCreateAndGetMaler() throws Exception { - var bruker_en = brukerRepository.findBrukerByBrukerId(DUMMY_EN.getBrukerId()).orElseThrow(); - var bruker_to = brukerRepository.findBrukerByBrukerId(DUMMY_TO.getBrukerId()).orElseThrow(); - saveDummyBestillingMal(bruker_en); - saveDummyBestillingMal(bruker_to); + var brukerEn = brukerRepository.findBrukerByBrukerId(DUMMY_EN.getBrukerId()).orElseThrow(); + var brukerTo = brukerRepository.findBrukerByBrukerId(DUMMY_TO.getBrukerId()).orElseThrow(); + saveDummyBestillingMal(brukerEn); + saveDummyBestillingMal(brukerTo); mockMvc.perform(get("/api/v1/malbestilling")) .andExpect(status().isOk()) @@ -128,8 +161,8 @@ void shouldCreateAndGetMaler() .andExpect(jsonPath("$.malbestillinger.test_en", hasSize(1))) .andExpect(jsonPath("$.malbestillinger.test_to", hasSize(1))) .andExpect(jsonPath("$.malbestillinger.test_en[0].malNavn").value(MALNAVN)) - .andExpect(jsonPath("$.malbestillinger.test_en[0].bruker.brukerId").value(bruker_en.getBrukerId())) - .andExpect(jsonPath("$.malbestillinger.test_to[0].bruker.brukerId").value(bruker_to.getBrukerId())); + .andExpect(jsonPath("$.malbestillinger.test_en[0].bruker.brukerId").value(brukerEn.getBrukerId())) + .andExpect(jsonPath("$.malbestillinger.test_to[0].bruker.brukerId").value(brukerTo.getBrukerId())); } @Test @@ -138,9 +171,9 @@ void shouldCreateAndGetMaler() void shouldCreateMalerFromExistingOrder() throws Exception { - var bruker_en = brukerRepository.findBrukerByBrukerId(DUMMY_EN.getBrukerId()).orElseThrow(); + var brukerEn = brukerRepository.findBrukerByBrukerId(DUMMY_EN.getBrukerId()).orElseThrow(); var testgruppe = saveDummyGruppe(); - var bestilling = saveDummyBestilling(bruker_en, testgruppe); + var bestilling = saveDummyBestilling(brukerEn, testgruppe); mockMvc.perform(post("/api/v1/malbestilling") .queryParam("bestillingId", String.valueOf(bestilling.getId())) @@ -153,14 +186,37 @@ void shouldCreateMalerFromExistingOrder() .andExpect(status().is4xxClientError()); } + @Test + @Transactional + @DisplayName("Oppretter mal fra gjeldende bestilling og tester at NotFoundError blir kastet ved ugyldig bestillingId") + void shouldCreateFormatertMalFromExistingOrder() + throws Exception { + + var brukerEn = brukerRepository.findBrukerByBrukerId(DUMMY_EN.getBrukerId()).orElseThrow(); + var testgruppe = saveDummyGruppe(); + var bestilling = saveDummyBestillingMedFormaterteKriterier(brukerEn, testgruppe); + + mockMvc.perform(post("/api/v1/malbestilling") + .queryParam("bestillingId", String.valueOf(bestilling.getId())) + .queryParam("malNavn", MALNAVN)) + .andExpect((content().string(not("fysiskDokument")))) + .andExpect((content().string(containsString("variantformat")))) + .andExpect(status().isOk()); + + mockMvc.perform(post("/api/v1/malbestilling") + .queryParam("bestillingId", UGYLDIG_BESTILLINGID) + .queryParam("malNavn", MALNAVN)) + .andExpect(status().is4xxClientError()); + } + @Test @Transactional @DisplayName("Oppretter, endrer navn på og sletter til slutt bestillingMal") void shouldCreateUpdateAndDeleteMal() throws Exception { - var bruker_en = brukerRepository.findBrukerByBrukerId(DUMMY_EN.getBrukerId()).orElseThrow(); - var bestillingMal = saveDummyBestillingMal(bruker_en); + var brukerEn = brukerRepository.findBrukerByBrukerId(DUMMY_EN.getBrukerId()).orElseThrow(); + var bestillingMal = saveDummyBestillingMal(brukerEn); mockMvc.perform(put("/api/v1/malbestilling/id/{id}", bestillingMal.getId()) .queryParam("malNavn", NYTT_MALNAVN)) @@ -208,6 +264,23 @@ Bestilling saveDummyBestilling(Bruker bruker, Testgruppe testgruppe) { ); } + Bestilling saveDummyBestillingMedFormaterteKriterier(Bruker bruker, Testgruppe testgruppe) { + return bestillingRepository.save( + Bestilling + .builder() + .gruppe(testgruppe) + .ferdig(false) + .antallIdenter(1) + .bestKriterier(BEST_KRITERIER_FORMATERT) + .bruker(bruker) + .beskrivelse(BESKRIVELSE) + .sistOppdatert(LocalDateTime.now()) + .ident(IDENT) + .navSyntetiskIdent(true) + .build() + ); + } + Testgruppe saveDummyGruppe() { return testgruppeRepository.save( Testgruppe.builder() diff --git a/apps/dolly-backend/src/test/java/no/nav/dolly/provider/api/TestgruppeControllerDeleteTest.java b/apps/dolly-backend/src/test/java/no/nav/dolly/provider/api/TestgruppeControllerDeleteTest.java index 427cc6a1e1c..3a80bdca67a 100644 --- a/apps/dolly-backend/src/test/java/no/nav/dolly/provider/api/TestgruppeControllerDeleteTest.java +++ b/apps/dolly-backend/src/test/java/no/nav/dolly/provider/api/TestgruppeControllerDeleteTest.java @@ -32,7 +32,5 @@ void deleteTestgruppe() .perform(get("/api/v1/gruppe/{id}", testgruppe.getId())) .andExpect(status().isNotFound()); assertThat(super.findTestgruppeById(testgruppe.getId())).isEmpty(); - } - } diff --git a/apps/dolly-backend/src/test/java/no/nav/dolly/service/NavigasjonServiceTest.java b/apps/dolly-backend/src/test/java/no/nav/dolly/service/NavigasjonServiceTest.java new file mode 100644 index 00000000000..3b5a71e268e --- /dev/null +++ b/apps/dolly-backend/src/test/java/no/nav/dolly/service/NavigasjonServiceTest.java @@ -0,0 +1,205 @@ +package no.nav.dolly.service; + +import ma.glasnost.orika.MapperFacade; +import no.nav.dolly.bestilling.pdldata.PdlDataConsumer; +import no.nav.dolly.bestilling.personservice.PersonServiceConsumer; +import no.nav.dolly.domain.PdlPersonBolk; +import no.nav.dolly.domain.jpa.Bestilling; +import no.nav.dolly.domain.jpa.Bruker; +import no.nav.dolly.domain.jpa.Testgruppe; +import no.nav.dolly.domain.jpa.Testident; +import no.nav.dolly.domain.resultset.entity.testgruppe.RsTestgruppe; +import no.nav.dolly.domain.resultset.entity.testident.RsWhereAmI; +import no.nav.dolly.exceptions.NotFoundException; +import no.nav.dolly.repository.IdentRepository; +import no.nav.testnav.libs.data.pdlforvalter.v1.FullPersonDTO; +import no.nav.testnav.libs.data.pdlforvalter.v1.PersonDTO; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +import java.util.Optional; + +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.when; + +class NavigasjonServiceTest { + + @Mock + private IdentRepository identRepository; + + @Mock + private IdentService identService; + + @Mock + private BestillingService bestillingService; + + @Mock + private MapperFacade mapperFacade; + + @Mock + private PersonServiceConsumer personServiceConsumer; + + @Mock + private PdlDataConsumer pdlDataConsumer; + + @InjectMocks + private NavigasjonService navigasjonService; + + @BeforeEach + void setUp() { + MockitoAnnotations.openMocks(this); + } + + @Test + void testNavigerTilIdentFound() { + String ident = "12445678901"; + RsWhereAmI expected = RsWhereAmI.builder() + .identHovedperson(ident) + .identNavigerTil(ident) + .build(); + + Testident testident = Testident.builder() + .ident(ident) + .testgruppe( + Testgruppe.builder() + .id(1L) + .build() + ).build(); + + FullPersonDTO fullPersonDTO = FullPersonDTO.builder() + .person(PersonDTO.builder().ident(ident).build()) + .build(); + + when(identRepository.findByIdent(any())).thenReturn(Optional.of(testident)); + when(identService.getPaginertIdentIndex(any(), any())).thenReturn(Optional.of(1)); + when(mapperFacade.map(any(), eq(RsWhereAmI.class))).thenReturn(expected); + when(pdlDataConsumer.getPersoner(any())).thenReturn(Flux.just(fullPersonDTO)); + when(personServiceConsumer.getPdlPersoner(any())).thenReturn(Flux.just(PdlPersonBolk.builder().build())); + + Mono result = navigasjonService.navigerTilIdent(ident, Bruker.builder().brukertype(Bruker.Brukertype.AZURE).build()); + + StepVerifier.create(result) + .expectNext(expected) + .verifyComplete(); + } + + @Test + void testBankidUserNavigerTilIdentAllowed() { + String identAllowed = "12881212345"; + + RsWhereAmI expected = RsWhereAmI.builder() + .identHovedperson(identAllowed) + .identNavigerTil(identAllowed) + .build(); + + Testident tiAllowed = Testident.builder() + .ident(identAllowed) + .testgruppe( + Testgruppe.builder() + .id(1L) + .build() + ).build(); + + FullPersonDTO fpAllowed = FullPersonDTO.builder() + .person(PersonDTO.builder().ident(identAllowed).build()) + .build(); + + when(identRepository.findByIdent(eq(identAllowed))).thenReturn(Optional.of(tiAllowed)); + + when(identService.getPaginertIdentIndex(any(), any())).thenReturn(Optional.of(1)); + when(mapperFacade.map(any(), eq(RsWhereAmI.class))).thenReturn(RsWhereAmI.builder().identHovedperson(identAllowed).build()); + when(pdlDataConsumer.getPersoner(any())).thenReturn(Flux.just(fpAllowed)); + when(personServiceConsumer.getPdlPersoner(any())).thenReturn(Flux.just(PdlPersonBolk.builder().build())); + + Mono result = navigasjonService.navigerTilIdent(identAllowed, Bruker.builder().brukertype(Bruker.Brukertype.BANKID).build()); + + StepVerifier.create(result) + .expectNext(expected) + .verifyComplete(); + } + + @Test + void testBankidUserNavigerTilIdentRefused() { + String identRefused = "12441212345"; + + Testident tiRefused = Testident.builder() + .ident(identRefused) + .testgruppe( + Testgruppe.builder() + .id(1L) + .build() + ).build(); + + FullPersonDTO fpRefused = FullPersonDTO.builder() + .person(PersonDTO.builder().ident(identRefused).build()) + .build(); + + when(identRepository.findByIdent(eq(identRefused))).thenReturn(Optional.of(tiRefused)); + + when(identService.getPaginertIdentIndex(any(), any())).thenReturn(Optional.of(1)); + when(mapperFacade.map(any(), eq(RsWhereAmI.class))).thenReturn(RsWhereAmI.builder().identHovedperson(identRefused).build()); + when(pdlDataConsumer.getPersoner(any())).thenReturn(Flux.just(fpRefused)); + when(personServiceConsumer.getPdlPersoner(any())).thenReturn(Flux.just(PdlPersonBolk.builder().build())); + + Mono result = navigasjonService.navigerTilIdent(identRefused, Bruker.builder().brukertype(Bruker.Brukertype.BANKID).build()); + + StepVerifier.create(result) + .expectError(NotFoundException.class) + .verify(); + } + + @Test + void testNavigerTilIdentNotFound() { + String ident = "12445678901"; + + when(identRepository.findByIdent(any())).thenReturn(Optional.empty()); + when(pdlDataConsumer.getPersoner(any())).thenReturn(Flux.empty()); + when(personServiceConsumer.getPdlPersoner(any())).thenReturn(Flux.empty()); + + Mono result = navigasjonService.navigerTilIdent(ident, Bruker.builder().brukertype(Bruker.Brukertype.AZURE).build()); + + StepVerifier.create(result) + .expectError(NotFoundException.class) + .verify(); + } + + @Test + void testNavigerTilBestillingFound() { + Long bestillingId = 1L; + + Testgruppe testgruppe = new Testgruppe(); + + Bestilling bestilling = new Bestilling(); + bestilling.setGruppe(testgruppe); + + when(bestillingService.fetchBestillingById(any())).thenReturn(bestilling); + when(bestillingService.getPaginertBestillingIndex(any(), any())).thenReturn(Optional.of(1)); + when(mapperFacade.map(any(Testgruppe.class), eq(RsTestgruppe.class))).thenReturn(new RsTestgruppe()); + + Mono result = navigasjonService.navigerTilBestilling(bestillingId); + + StepVerifier.create(result) + .expectNextMatches(rsWhereAmI -> rsWhereAmI.getBestillingNavigerTil().equals(bestillingId)) + .verifyComplete(); + } + + @Test + void testNavigerTilBestillingNotFound() { + Long bestillingId = 1L; + + when(bestillingService.fetchBestillingById(any())).thenReturn(null); + + Mono result = navigasjonService.navigerTilBestilling(bestillingId); + + StepVerifier.create(result) + .expectError(NotFoundException.class) + .verify(); + } +} \ No newline at end of file diff --git a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/provider/web/ForwardAndRedirectController.java b/apps/dolly-frontend/src/main/java/no/nav/dolly/web/provider/web/ForwardAndRedirectController.java index 46b50f7d5ff..6f2e3246744 100644 --- a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/provider/web/ForwardAndRedirectController.java +++ b/apps/dolly-frontend/src/main/java/no/nav/dolly/web/provider/web/ForwardAndRedirectController.java @@ -33,6 +33,7 @@ public RouterFunction htmlRouter(@Value("classpath:/static/index .andRoute(RequestPredicates.GET("/dollysoek/**"), indexHandler) .andRoute(RequestPredicates.GET("/tenor/personer/**"), indexHandler) .andRoute(RequestPredicates.GET("/admin/orgtilgang/**"), indexHandler) - .andRoute(RequestPredicates.GET("/admin/levendearbeidsforhold/**"), indexHandler); + .andRoute(RequestPredicates.GET("/admin/levendearbeidsforhold/**"), indexHandler) + .andRoute(RequestPredicates.GET("/nyansettelser/**"), indexHandler); } } diff --git a/apps/dolly-frontend/src/main/js/package-lock.json b/apps/dolly-frontend/src/main/js/package-lock.json index 05805c1532d..6d4cc01881f 100644 --- a/apps/dolly-frontend/src/main/js/package-lock.json +++ b/apps/dolly-frontend/src/main/js/package-lock.json @@ -1,12 +1,12 @@ { "name": "dolly", - "version": "3.0.23", + "version": "3.0.24", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "dolly", - "version": "3.0.23", + "version": "3.0.24", "license": "ISC", "dependencies": { "@grafana/faro-react": "^1.1.2", @@ -1955,14 +1955,14 @@ } }, "node_modules/@playwright/experimental-ct-core": { - "version": "1.46.0", - "resolved": "https://registry.npmjs.org/@playwright/experimental-ct-core/-/experimental-ct-core-1.46.0.tgz", - "integrity": "sha512-4bHw+P0ub0A/B6tbiqLQFwvaR+wsH5fE2yt1rxWg/dtE8uGhqEeAav9TX7j4PmILM86R3Le21h94wdDIHyeJBA==", + "version": "1.46.1", + "resolved": "https://registry.npmjs.org/@playwright/experimental-ct-core/-/experimental-ct-core-1.46.1.tgz", + "integrity": "sha512-vmRVmrQZ8mEHCbyrSB/l4hPcz95DCgFY7lCr8jKaY+dresap5WzxgHs2l2c/mNjiS5rFR6BnxKvqhCt0BBIKeA==", "dev": true, "license": "Apache-2.0", "dependencies": { - "playwright": "1.46.0", - "playwright-core": "1.46.0", + "playwright": "1.46.1", + "playwright-core": "1.46.1", "vite": "^5.2.8" }, "engines": { @@ -1970,13 +1970,13 @@ } }, "node_modules/@playwright/experimental-ct-react": { - "version": "1.46.0", - "resolved": "https://registry.npmjs.org/@playwright/experimental-ct-react/-/experimental-ct-react-1.46.0.tgz", - "integrity": "sha512-BSEfTBes2ljEQZxmtPpEQi8ZJns+B9F5h226Fk4/DdJbvueriEcJa4uls6KRIScSX8gd27Vg3P9T/buxW2BvjA==", + "version": "1.46.1", + "resolved": "https://registry.npmjs.org/@playwright/experimental-ct-react/-/experimental-ct-react-1.46.1.tgz", + "integrity": "sha512-MTOpiVrooq5gMwh0v6OazW4udTbUqVCDQVNX0d20u3+q8Frl9pO522eDHdEQ4bWTOknmyDyTQlXyK6GWlKHjqQ==", "dev": true, "license": "Apache-2.0", "dependencies": { - "@playwright/experimental-ct-core": "1.46.0", + "@playwright/experimental-ct-core": "1.46.1", "@vitejs/plugin-react": "^4.2.1" }, "bin": { @@ -1987,13 +1987,13 @@ } }, "node_modules/@playwright/test": { - "version": "1.46.0", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.46.0.tgz", - "integrity": "sha512-/QYft5VArOrGRP5pgkrfKksqsKA6CEFyGQ/gjNe6q0y4tZ1aaPfq4gIjudr1s3D+pXyrPRdsy4opKDrjBabE5w==", + "version": "1.46.1", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.46.1.tgz", + "integrity": "sha512-Fq6SwLujA/DOIvNC2EL/SojJnkKf/rAwJ//APpJJHRyMi1PdKrY3Az+4XNQ51N4RTbItbIByQ0jgd1tayq1aeA==", "dev": true, "license": "Apache-2.0", "dependencies": { - "playwright": "1.46.0" + "playwright": "1.46.1" }, "bin": { "playwright": "cli.js" @@ -2388,18 +2388,18 @@ } }, "node_modules/@remix-run/router": { - "version": "1.19.0", - "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.19.0.tgz", - "integrity": "sha512-zDICCLKEwbVYTS6TjYaWtHXxkdoUvD/QXvyVZjGCsWz5vyH7aFeONlPffPdW+Y/t6KT0MgXb2Mfjun9YpWN1dA==", + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.19.1.tgz", + "integrity": "sha512-S45oynt/WH19bHbIXjtli6QmwNYvaz+vtnubvNpNDvUOoA/OWh6j1OikIP3G+v5GHdxyC6EXoChG3HgYGEUfcg==", "license": "MIT", "engines": { "node": ">=14.0.0" } }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.20.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.20.0.tgz", - "integrity": "sha512-TSpWzflCc4VGAUJZlPpgAJE1+V60MePDQnBd7PPkpuEmOy8i87aL6tinFGKBFKuEDikYpig72QzdT3QPYIi+oA==", + "version": "4.21.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.21.0.tgz", + "integrity": "sha512-WTWD8PfoSAJ+qL87lE7votj3syLavxunWhzCnx3XFxFiI/BA/r3X7MUM8dVrH8rb2r4AiO8jJsr3ZjdaftmnfA==", "cpu": [ "arm" ], @@ -2411,9 +2411,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.20.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.20.0.tgz", - "integrity": "sha512-u00Ro/nok7oGzVuh/FMYfNoGqxU5CPWz1mxV85S2w9LxHR8OoMQBuSk+3BKVIDYgkpeOET5yXkx90OYFc+ytpQ==", + "version": "4.21.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.21.0.tgz", + "integrity": "sha512-a1sR2zSK1B4eYkiZu17ZUZhmUQcKjk2/j9Me2IDjk1GHW7LB5Z35LEzj9iJch6gtUfsnvZs1ZNyDW2oZSThrkA==", "cpu": [ "arm64" ], @@ -2425,9 +2425,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.20.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.20.0.tgz", - "integrity": "sha512-uFVfvzvsdGtlSLuL0ZlvPJvl6ZmrH4CBwLGEFPe7hUmf7htGAN+aXo43R/V6LATyxlKVC/m6UsLb7jbG+LG39Q==", + "version": "4.21.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.21.0.tgz", + "integrity": "sha512-zOnKWLgDld/svhKO5PD9ozmL6roy5OQ5T4ThvdYZLpiOhEGY+dp2NwUmxK0Ld91LrbjrvtNAE0ERBwjqhZTRAA==", "cpu": [ "arm64" ], @@ -2439,9 +2439,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.20.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.20.0.tgz", - "integrity": "sha512-xbrMDdlev53vNXexEa6l0LffojxhqDTBeL+VUxuuIXys4x6xyvbKq5XqTXBCEUA8ty8iEJblHvFaWRJTk/icAQ==", + "version": "4.21.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.21.0.tgz", + "integrity": "sha512-7doS8br0xAkg48SKE2QNtMSFPFUlRdw9+votl27MvT46vo44ATBmdZdGysOevNELmZlfd+NEa0UYOA8f01WSrg==", "cpu": [ "x64" ], @@ -2453,9 +2453,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.20.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.20.0.tgz", - "integrity": "sha512-jMYvxZwGmoHFBTbr12Xc6wOdc2xA5tF5F2q6t7Rcfab68TT0n+r7dgawD4qhPEvasDsVpQi+MgDzj2faOLsZjA==", + "version": "4.21.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.21.0.tgz", + "integrity": "sha512-pWJsfQjNWNGsoCq53KjMtwdJDmh/6NubwQcz52aEwLEuvx08bzcy6tOUuawAOncPnxz/3siRtd8hiQ32G1y8VA==", "cpu": [ "arm" ], @@ -2467,9 +2467,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.20.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.20.0.tgz", - "integrity": "sha512-1asSTl4HKuIHIB1GcdFHNNZhxAYEdqML/MW4QmPS4G0ivbEcBr1JKlFLKsIRqjSwOBkdItn3/ZDlyvZ/N6KPlw==", + "version": "4.21.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.21.0.tgz", + "integrity": "sha512-efRIANsz3UHZrnZXuEvxS9LoCOWMGD1rweciD6uJQIx2myN3a8Im1FafZBzh7zk1RJ6oKcR16dU3UPldaKd83w==", "cpu": [ "arm" ], @@ -2481,9 +2481,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.20.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.20.0.tgz", - "integrity": "sha512-COBb8Bkx56KldOYJfMf6wKeYJrtJ9vEgBRAOkfw6Ens0tnmzPqvlpjZiLgkhg6cA3DGzCmLmmd319pmHvKWWlQ==", + "version": "4.21.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.21.0.tgz", + "integrity": "sha512-ZrPhydkTVhyeGTW94WJ8pnl1uroqVHM3j3hjdquwAcWnmivjAwOYjTEAuEDeJvGX7xv3Z9GAvrBkEzCgHq9U1w==", "cpu": [ "arm64" ], @@ -2495,9 +2495,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.20.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.20.0.tgz", - "integrity": "sha512-+it+mBSyMslVQa8wSPvBx53fYuZK/oLTu5RJoXogjk6x7Q7sz1GNRsXWjn6SwyJm8E/oMjNVwPhmNdIjwP135Q==", + "version": "4.21.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.21.0.tgz", + "integrity": "sha512-cfaupqd+UEFeURmqNP2eEvXqgbSox/LHOyN9/d2pSdV8xTrjdg3NgOFJCtc1vQ/jEke1qD0IejbBfxleBPHnPw==", "cpu": [ "arm64" ], @@ -2509,9 +2509,9 @@ ] }, "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { - "version": "4.20.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.20.0.tgz", - "integrity": "sha512-yAMvqhPfGKsAxHN8I4+jE0CpLWD8cv4z7CK7BMmhjDuz606Q2tFKkWRY8bHR9JQXYcoLfopo5TTqzxgPUjUMfw==", + "version": "4.21.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.21.0.tgz", + "integrity": "sha512-ZKPan1/RvAhrUylwBXC9t7B2hXdpb/ufeu22pG2psV7RN8roOfGurEghw1ySmX/CmDDHNTDDjY3lo9hRlgtaHg==", "cpu": [ "ppc64" ], @@ -2523,9 +2523,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.20.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.20.0.tgz", - "integrity": "sha512-qmuxFpfmi/2SUkAw95TtNq/w/I7Gpjurx609OOOV7U4vhvUhBcftcmXwl3rqAek+ADBwSjIC4IVNLiszoj3dPA==", + "version": "4.21.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.21.0.tgz", + "integrity": "sha512-H1eRaCwd5E8eS8leiS+o/NqMdljkcb1d6r2h4fKSsCXQilLKArq6WS7XBLDu80Yz+nMqHVFDquwcVrQmGr28rg==", "cpu": [ "riscv64" ], @@ -2537,9 +2537,9 @@ ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.20.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.20.0.tgz", - "integrity": "sha512-I0BtGXddHSHjV1mqTNkgUZLnS3WtsqebAXv11D5BZE/gfw5KoyXSAXVqyJximQXNvNzUo4GKlCK/dIwXlz+jlg==", + "version": "4.21.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.21.0.tgz", + "integrity": "sha512-zJ4hA+3b5tu8u7L58CCSI0A9N1vkfwPhWd/puGXwtZlsB5bTkwDNW/+JCU84+3QYmKpLi+XvHdmrlwUwDA6kqw==", "cpu": [ "s390x" ], @@ -2551,9 +2551,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.20.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.20.0.tgz", - "integrity": "sha512-y+eoL2I3iphUg9tN9GB6ku1FA8kOfmF4oUEWhztDJ4KXJy1agk/9+pejOuZkNFhRwHAOxMsBPLbXPd6mJiCwew==", + "version": "4.21.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.21.0.tgz", + "integrity": "sha512-e2hrvElFIh6kW/UNBQK/kzqMNY5mO+67YtEh9OA65RM5IJXYTWiXjX6fjIiPaqOkBthYF1EqgiZ6OXKcQsM0hg==", "cpu": [ "x64" ], @@ -2565,9 +2565,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.20.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.20.0.tgz", - "integrity": "sha512-hM3nhW40kBNYUkZb/r9k2FKK+/MnKglX7UYd4ZUy5DJs8/sMsIbqWK2piZtVGE3kcXVNj3B2IrUYROJMMCikNg==", + "version": "4.21.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.21.0.tgz", + "integrity": "sha512-1vvmgDdUSebVGXWX2lIcgRebqfQSff0hMEkLJyakQ9JQUbLDkEaMsPTLOmyccyC6IJ/l3FZuJbmrBw/u0A0uCQ==", "cpu": [ "x64" ], @@ -2579,9 +2579,9 @@ ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.20.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.20.0.tgz", - "integrity": "sha512-psegMvP+Ik/Bg7QRJbv8w8PAytPA7Uo8fpFjXyCRHWm6Nt42L+JtoqH8eDQ5hRP7/XW2UiIriy1Z46jf0Oa1kA==", + "version": "4.21.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.21.0.tgz", + "integrity": "sha512-s5oFkZ/hFcrlAyBTONFY1TWndfyre1wOMwU+6KCpm/iatybvrRgmZVM+vCFwxmC5ZhdlgfE0N4XorsDpi7/4XQ==", "cpu": [ "arm64" ], @@ -2593,9 +2593,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.20.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.20.0.tgz", - "integrity": "sha512-GabekH3w4lgAJpVxkk7hUzUf2hICSQO0a/BLFA11/RMxQT92MabKAqyubzDZmMOC/hcJNlc+rrypzNzYl4Dx7A==", + "version": "4.21.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.21.0.tgz", + "integrity": "sha512-G9+TEqRnAA6nbpqyUqgTiopmnfgnMkR3kMukFBDsiyy23LZvUCpiUwjTRx6ezYCjJODXrh52rBR9oXvm+Fp5wg==", "cpu": [ "ia32" ], @@ -2607,9 +2607,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.20.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.20.0.tgz", - "integrity": "sha512-aJ1EJSuTdGnM6qbVC4B5DSmozPTqIag9fSzXRNNo+humQLG89XpPgdt16Ia56ORD7s+H8Pmyx44uczDQ0yDzpg==", + "version": "4.21.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.21.0.tgz", + "integrity": "sha512-2jsCDZwtQvRhejHLfZ1JY6w6kEuEtfF9nzYsZxzSlNVKDX+DpsDJ+Rbjkm74nvg2rdx0gwBS+IMdvwJuq3S9pQ==", "cpu": [ "x64" ], @@ -2741,12 +2741,12 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "22.3.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.3.0.tgz", - "integrity": "sha512-nrWpWVaDZuaVc5X84xJ0vNrLvomM205oQyLsRt7OHNZbSHslcWsvgFR7O7hire2ZonjLrWBbedmotmIlJDVd6g==", + "version": "22.4.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.4.1.tgz", + "integrity": "sha512-1tbpb9325+gPnKK0dMm+/LMriX0vKxf6RnB0SZUqfyVkQ4fMgUSySqhxE/y8Jvs4NyF1yHzTfG9KlnkIODxPKg==", "license": "MIT", "dependencies": { - "undici-types": "~6.18.2" + "undici-types": "~6.19.2" } }, "node_modules/@types/parse-json": { @@ -2921,9 +2921,9 @@ "license": "MIT" }, "node_modules/@types/unist": { - "version": "2.0.10", - "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.10.tgz", - "integrity": "sha512-IfYcSBWE3hLpBg8+X2SEa8LVkJdJEkT2Ese2aaLs3ptGdVtABxndrMaxuFlQ1qdFf9Q5rDvDpxI3WwgvKFAsQA==", + "version": "2.0.11", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.11.tgz", + "integrity": "sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA==", "license": "MIT" }, "node_modules/@types/use-sync-external-store": { @@ -3939,9 +3939,9 @@ } }, "node_modules/country-data-list": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/country-data-list/-/country-data-list-1.3.0.tgz", - "integrity": "sha512-wZ052MKT8MXTnp/E9bbQPhMgk9p7L1XnYhv2Q1+AMnfjq5UzmWMJOORnLYdqywobxELNA7D+zC57VvY+nsH7AQ==", + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/country-data-list/-/country-data-list-1.3.4.tgz", + "integrity": "sha512-BKwqyeXbmhhzOEf1gcH1Ui1X/ni8YmXTllhCTNW23ja/u7EY1lKS0hrK68kngw5ni6WooXLARXmnHxGnKDWQpQ==", "license": "MIT", "dependencies": { "currency-symbol-map": "~5" @@ -4283,9 +4283,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.5.7", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.7.tgz", - "integrity": "sha512-6FTNWIWMxMy/ZY6799nBlPtF1DFDQ6VQJ7yyDP27SJNt5lwtQ5ufqVvHylb3fdQefvRcgA3fKcFMJi9OLwBRNw==", + "version": "1.5.11", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.11.tgz", + "integrity": "sha512-R1CccCDYqndR25CaXFd6hp/u9RaaMcftMkphmvuepXr5b1vfLkRml6aWVeBhXJ7rbevHkKEMJtz8XqPf7ffmew==", "dev": true, "license": "ISC" }, @@ -7392,13 +7392,13 @@ } }, "node_modules/playwright": { - "version": "1.46.0", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.46.0.tgz", - "integrity": "sha512-XYJ5WvfefWONh1uPAUAi0H2xXV5S3vrtcnXe6uAOgdGi3aSpqOSXX08IAjXW34xitfuOJsvXU5anXZxPSEQiJw==", + "version": "1.46.1", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.46.1.tgz", + "integrity": "sha512-oPcr1yqoXLCkgKtD5eNUPLiN40rYEM39odNpIb6VE6S7/15gJmA1NzVv6zJYusV0e7tzvkU/utBFNa/Kpxmwng==", "dev": true, "license": "Apache-2.0", "dependencies": { - "playwright-core": "1.46.0" + "playwright-core": "1.46.1" }, "bin": { "playwright": "cli.js" @@ -7411,9 +7411,9 @@ } }, "node_modules/playwright-core": { - "version": "1.46.0", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.46.0.tgz", - "integrity": "sha512-9Y/d5UIwuJk8t3+lhmMSAJyNP1BUC/DqP3cQJDQQL/oWqAiuPTLgy7Q5dzglmTLwcBRdetzgNM/gni7ckfTr6A==", + "version": "1.46.1", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.46.1.tgz", + "integrity": "sha512-h9LqIQaAv+CYvWzsZ+h3RsrqCStkBHlgo6/TJlFst3cOTlLghBQlJwPOZKQJTKNaD3QIB7aAVQ+gfWbN3NXB7A==", "dev": true, "license": "Apache-2.0", "bin": { @@ -7993,12 +7993,12 @@ } }, "node_modules/react-router": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.26.0.tgz", - "integrity": "sha512-wVQq0/iFYd3iZ9H2l3N3k4PL8EEHcb0XlU2Na8nEwmiXgIUElEH6gaJDtUQxJ+JFzmIXaQjfdpcGWaM6IoQGxg==", + "version": "6.26.1", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.26.1.tgz", + "integrity": "sha512-kIwJveZNwp7teQRI5QmwWo39A5bXRyqpH0COKKmPnyD2vBvDwgFXSqDUYtt1h+FEyfnE8eXr7oe0MxRzVwCcvQ==", "license": "MIT", "dependencies": { - "@remix-run/router": "1.19.0" + "@remix-run/router": "1.19.1" }, "engines": { "node": ">=14.0.0" @@ -8008,13 +8008,13 @@ } }, "node_modules/react-router-dom": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.26.0.tgz", - "integrity": "sha512-RRGUIiDtLrkX3uYcFiCIxKFWMcWQGMojpYZfcstc63A1+sSnVgILGIm9gNUA6na3Fm1QuPGSBQH2EMbAZOnMsQ==", + "version": "6.26.1", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.26.1.tgz", + "integrity": "sha512-veut7m41S1fLql4pLhxeSW3jlqs+4MtjRLj0xvuCEXsxusJCbs6I8yn9BxzzDX2XDgafrccY6hwjmd/bL54tFw==", "license": "MIT", "dependencies": { - "@remix-run/router": "1.19.0", - "react-router": "6.26.0" + "@remix-run/router": "1.19.1", + "react-router": "6.26.1" }, "engines": { "node": ">=14.0.0" @@ -8398,9 +8398,9 @@ } }, "node_modules/rollup": { - "version": "4.20.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.20.0.tgz", - "integrity": "sha512-6rbWBChcnSGzIlXeIdNIZTopKYad8ZG8ajhl78lGRLsI2rX8IkaotQhVas2Ma+GPxJav19wrSzvRvuiv0YKzWw==", + "version": "4.21.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.21.0.tgz", + "integrity": "sha512-vo+S/lfA2lMS7rZ2Qoubi6I5hwZwzXeUIctILZLbHI+laNtvhhOIon2S1JksA5UEDQ7l3vberd0fxK44lTYjbQ==", "dev": true, "license": "MIT", "dependencies": { @@ -8414,22 +8414,22 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.20.0", - "@rollup/rollup-android-arm64": "4.20.0", - "@rollup/rollup-darwin-arm64": "4.20.0", - "@rollup/rollup-darwin-x64": "4.20.0", - "@rollup/rollup-linux-arm-gnueabihf": "4.20.0", - "@rollup/rollup-linux-arm-musleabihf": "4.20.0", - "@rollup/rollup-linux-arm64-gnu": "4.20.0", - "@rollup/rollup-linux-arm64-musl": "4.20.0", - "@rollup/rollup-linux-powerpc64le-gnu": "4.20.0", - "@rollup/rollup-linux-riscv64-gnu": "4.20.0", - "@rollup/rollup-linux-s390x-gnu": "4.20.0", - "@rollup/rollup-linux-x64-gnu": "4.20.0", - "@rollup/rollup-linux-x64-musl": "4.20.0", - "@rollup/rollup-win32-arm64-msvc": "4.20.0", - "@rollup/rollup-win32-ia32-msvc": "4.20.0", - "@rollup/rollup-win32-x64-msvc": "4.20.0", + "@rollup/rollup-android-arm-eabi": "4.21.0", + "@rollup/rollup-android-arm64": "4.21.0", + "@rollup/rollup-darwin-arm64": "4.21.0", + "@rollup/rollup-darwin-x64": "4.21.0", + "@rollup/rollup-linux-arm-gnueabihf": "4.21.0", + "@rollup/rollup-linux-arm-musleabihf": "4.21.0", + "@rollup/rollup-linux-arm64-gnu": "4.21.0", + "@rollup/rollup-linux-arm64-musl": "4.21.0", + "@rollup/rollup-linux-powerpc64le-gnu": "4.21.0", + "@rollup/rollup-linux-riscv64-gnu": "4.21.0", + "@rollup/rollup-linux-s390x-gnu": "4.21.0", + "@rollup/rollup-linux-x64-gnu": "4.21.0", + "@rollup/rollup-linux-x64-musl": "4.21.0", + "@rollup/rollup-win32-arm64-msvc": "4.21.0", + "@rollup/rollup-win32-ia32-msvc": "4.21.0", + "@rollup/rollup-win32-x64-msvc": "4.21.0", "fsevents": "~2.3.2" } }, @@ -9317,9 +9317,9 @@ } }, "node_modules/type-fest": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.24.0.tgz", - "integrity": "sha512-spAaHzc6qre0TlZQQ2aA/nGMe+2Z/wyGk5Z+Ru2VUfdNwT6kWO6TjevOlpebsATEG1EIQ2sOiDszud3lO5mt/Q==", + "version": "4.25.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.25.0.tgz", + "integrity": "sha512-bRkIGlXsnGBRBQRAY56UXBm//9qH4bmJfFvq83gSz41N282df+fjy8ofcEgc1sM8geNt5cl6mC2g9Fht1cs8Aw==", "dev": true, "license": "(MIT OR CC0-1.0)", "engines": { @@ -9460,9 +9460,9 @@ } }, "node_modules/undici-types": { - "version": "6.18.2", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.18.2.tgz", - "integrity": "sha512-5ruQbENj95yDYJNS3TvcaxPMshV7aizdv/hWYjGIKoANWKjhWNBsr2YEuYZKodQulB1b8l7ILOuDQep3afowQQ==", + "version": "6.19.6", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.6.tgz", + "integrity": "sha512-e/vggGopEfTKSvj4ihnOLTsqhrKRN3LeO6qSN/GxohhuRv8qH9bNQ4B8W7e/vFL+0XTnmHPB4/kegunZGA4Org==", "license": "MIT" }, "node_modules/update-browserslist-db": { @@ -9569,14 +9569,14 @@ "license": "MIT" }, "node_modules/vite": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.0.tgz", - "integrity": "sha512-5xokfMX0PIiwCMCMb9ZJcMyh5wbBun0zUzKib+L65vAZ8GY9ePZMXxFrHbr/Kyll2+LSCY7xtERPpxkBDKngwg==", + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.1.tgz", + "integrity": "sha512-1oE6yuNXssjrZdblI9AfBbHCC41nnyoVoEZxQnID6yvQZAFBzxxkqoFLtHUMkYunL8hwOLEjgTuxpkRxvba3kA==", "dev": true, "license": "MIT", "dependencies": { "esbuild": "^0.21.3", - "postcss": "^8.4.40", + "postcss": "^8.4.41", "rollup": "^4.13.0" }, "bin": { diff --git a/apps/dolly-frontend/src/main/js/package.json b/apps/dolly-frontend/src/main/js/package.json index 4d441939fcf..d3dcc7a8539 100644 --- a/apps/dolly-frontend/src/main/js/package.json +++ b/apps/dolly-frontend/src/main/js/package.json @@ -1,6 +1,6 @@ { "name": "dolly", - "version": "3.0.23", + "version": "3.0.24", "type": "module", "description": "", "main": "index.js", diff --git a/apps/dolly-frontend/src/main/js/playwright.config.js b/apps/dolly-frontend/src/main/js/playwright.config.js index e56c24f3f73..21a11bd1ed9 100644 --- a/apps/dolly-frontend/src/main/js/playwright.config.js +++ b/apps/dolly-frontend/src/main/js/playwright.config.js @@ -14,10 +14,9 @@ export default defineConfig({ /* Fail the build on CI if you accidentally left test.only in the source code. */ forbidOnly: !!process.env.CI, - /* Retry on CI only */ - retries: process.env.CI ? 2 : 0, - // Fewer workers on CI to make tests more stable - workers: process.env.CI ? 2 : undefined, + retries: process.env.CI ? 2 : 1, + // One worker on CI to make tests more stable + workers: process.env.CI ? 1 : 3, reporter: 'html', /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ diff --git a/apps/dolly-frontend/src/main/js/playwright/mocks/Selectors.tsx b/apps/dolly-frontend/src/main/js/playwright/mocks/Selectors.tsx index 0892ace3b16..885b34412f0 100644 --- a/apps/dolly-frontend/src/main/js/playwright/mocks/Selectors.tsx +++ b/apps/dolly-frontend/src/main/js/playwright/mocks/Selectors.tsx @@ -95,6 +95,7 @@ export enum TestComponentSelectors { BUTTON_TENOR_CLEAR_HEADER = 'button-tenor-clear-options', BUTTON_MODAL_CLOSE = 'button-modal-lukk', SELECT_PERSON_SEARCH = 'select-person-search', + SELECT_MAL = 'select-mal', HOVER_MILJOE = 'hover-miljoe', CHECKBOX_FORBEDRING_ANONYM = 'checkbox-forbedring-anonym', CHECKBOX_TENORSOEK = 'checkbox-tenorsoek', diff --git a/apps/dolly-frontend/src/main/js/playwright/tests/OpprettBestilling.spec.ts b/apps/dolly-frontend/src/main/js/playwright/tests/OpprettBestilling.spec.ts index 212cec403e4..3bc6744c7e0 100644 --- a/apps/dolly-frontend/src/main/js/playwright/tests/OpprettBestilling.spec.ts +++ b/apps/dolly-frontend/src/main/js/playwright/tests/OpprettBestilling.spec.ts @@ -1,31 +1,61 @@ import { expect, test } from '#/globalSetup' import { TestComponentSelectors } from '#/mocks/Selectors' -test.describe('Oppretter bestilling med alle artifakter som er avhengige av Q1 eller Q2 og sjekker at disse blir huket av', () => { +test.describe('Oppretter bestilling med artifakter som er avhengige av Q1 eller Q2 og sjekker at disse blir huket av', () => { test('passes', async ({ page }) => { await page.goto('gruppe/1') await page.getByTestId(TestComponentSelectors.BUTTON_OPPRETT_PERSONER).click() await page.getByTestId(TestComponentSelectors.BUTTON_START_BESTILLING).click() + await page.waitForTimeout(2000) + const fjernMiljoeAvhengige = await page .getByTestId(TestComponentSelectors.BUTTON_FJERN_MILJOE_AVHENGIG) .all() + expect(fjernMiljoeAvhengige).not.toHaveLength(0) + for (const button_velg_miljoeavhengig of await page .getByTestId(TestComponentSelectors.BUTTON_VELG_MILJOE_AVHENGIG) .all()) { await button_velg_miljoeavhengig.click() - await page.getByTestId(TestComponentSelectors.BUTTON_VIDERE).click() - await page.getByTestId(TestComponentSelectors.BUTTON_VIDERE).click() - - await expect(page.locator('#q1')).toBeChecked() - await expect(page.locator('#q2')).toBeChecked() - await expect(page.locator('#q4')).not.toBeChecked() - - await page.getByTestId(TestComponentSelectors.BUTTON_TILBAKE).click() - await page.getByTestId(TestComponentSelectors.BUTTON_TILBAKE).click() - for (const button_fjern_miljoeavhengig of fjernMiljoeAvhengige) { - await button_fjern_miljoeavhengig.click() - } + await page.waitForTimeout(100) + } + await page.getByTestId(TestComponentSelectors.BUTTON_VIDERE).click() + await page.getByTestId(TestComponentSelectors.BUTTON_VIDERE).click() + + await expect(page.locator('#q1')).toBeChecked() + await expect(page.locator('#q2')).toBeChecked() + await expect(page.locator('#q4')).not.toBeChecked() + + await page.getByTestId(TestComponentSelectors.BUTTON_TILBAKE).click() + await page.getByTestId(TestComponentSelectors.BUTTON_TILBAKE).click() + for (const button_fjern_miljoeavhengig of fjernMiljoeAvhengige) { + await button_fjern_miljoeavhengig.click() + } + }) +}) + +test.describe('Oppretter bestilling med alle resterende artifakter', () => { + test('passes', async ({ page }) => { + await page.goto('gruppe/1') + await page.getByTestId(TestComponentSelectors.BUTTON_OPPRETT_PERSONER).click() + await page.getByTestId(TestComponentSelectors.TOGGLE_MAL).click() + await page.getByTestId(TestComponentSelectors.SELECT_MAL).click() + + await page.getByTestId(TestComponentSelectors.BUTTON_START_BESTILLING).click() + await page.waitForTimeout(2000) + + for (const button_velg_alle of await page + .getByTestId(TestComponentSelectors.BUTTON_VELG_ALLE) + .all()) { + await button_velg_alle.click() + await page.waitForTimeout(100) } + await page.getByTestId(TestComponentSelectors.BUTTON_VIDERE).click() + await page.waitForTimeout(500) + + await page.getByTestId(TestComponentSelectors.BUTTON_TILBAKE).click() + + expect(page.url()).toContain('bestilling') }) }) diff --git a/apps/dolly-frontend/src/main/js/src/allRoutes.tsx b/apps/dolly-frontend/src/main/js/src/allRoutes.tsx index 363ed194d8e..4b8045d2d5f 100644 --- a/apps/dolly-frontend/src/main/js/src/allRoutes.tsx +++ b/apps/dolly-frontend/src/main/js/src/allRoutes.tsx @@ -2,6 +2,7 @@ import React, { lazy } from 'react' import { Navigate } from 'react-router-dom' import GruppeConnector from '@/pages/gruppe/GruppeConnector' import { OrganisasjonTenorSoekPage } from '@/pages/organisasjoner/OrganisasjonTenorSoek/OrganisasjonTenorSoekPage' +import NyansettelserPage from '@/pages/nyansettelser/NyansettelserPage' const GruppeOversikt = lazy(() => import('@/pages/gruppeOversikt/GruppeOversiktConnector')) const Organisasjon = lazy(() => import('@/pages/organisasjoner/Organisasjoner')) @@ -79,6 +80,11 @@ const allRoutes = [ breadcrumb: 'Levende-arbeidsforhold', element: () => , }, + { + path: '/nyansettelser', + breadcrumb: 'Nyansettelser', + element: () => , + }, ] export default allRoutes diff --git a/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/startModal/NyIdent/NyIdent.tsx b/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/startModal/NyIdent/NyIdent.tsx index a6e098c1b9d..fe161c36d94 100644 --- a/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/startModal/NyIdent/NyIdent.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/startModal/NyIdent/NyIdent.tsx @@ -119,6 +119,7 @@ export const NyIdent = ({ brukernavn, onAvbryt, onSubmit }: NyBestillingProps) = isDisabled={!malAktiv} /> { const errorContext: ShowErrorContextType = useContext(ShowErrorContext) const [step, setStep] = useState(0) const CurrentStepComponent: any = STEPS[step] + const stepMaxIndex = STEPS.length - 1 const formMethods = useForm({ mode: 'onChange', defaultValues: initialValues, @@ -88,7 +89,13 @@ export const StegVelger = ({ initialValues, onSubmit }) => { {labels.map((label, index) => ( - {label.label} + index < stepMaxIndex && setStep(index)} + > + {label.label} + ))} diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/validation/partials/adresser.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/validation/partials/adresser.tsx index 781bee223b1..def62a7e4c3 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/validation/partials/adresser.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/validation/partials/adresser.tsx @@ -67,6 +67,7 @@ const validFradato = () => { return true } const fullForm = testContext.from && testContext.from[testContext.from.length - 1]?.value + const personFoerLeggTil = testContext?.options?.context?.personFoerLeggTil const nyeAdresser = fullForm?.pdldata?.person?.bostedsadresse ? [...fullForm.pdldata.person.bostedsadresse] @@ -84,8 +85,7 @@ const validFradato = () => { } nyeAdresser.splice(adresseIndex, 1) - const tidligereAdresser = - fullForm.personFoerLeggTil?.pdlforvalter?.person?.bostedsadresse || [] + const tidligereAdresser = personFoerLeggTil?.pdlforvalter?.person?.bostedsadresse || [] return !( overlapperMedAdresse(val, tildato, nyeAdresser, true) || diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/validation/validation.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/validation/validation.tsx index 72ccb88d8f2..46fd39035f5 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/validation/validation.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/validation/validation.tsx @@ -28,12 +28,13 @@ import { isSameDay } from 'date-fns' const testGyldigFom = (val) => { return val.test('is-unique', (selected: string, testContext: any) => { + const personFoerLeggTil = testContext?.options?.context?.personFoerLeggTil const fullForm = testContext.from && testContext.from[testContext.from.length - 1]?.value if (selected === null || selected === '') { return true } const navn = fullForm?.navn ? [fullForm.navn] : fullForm?.pdldata?.person?.navn - const navnFoerLeggTil = fullForm?.personFoerLeggTil?.pdlforvalter?.person?.navn + const navnFoerLeggTil = personFoerLeggTil?.pdlforvalter?.person?.navn let antallLike = 0 navn?.concat(navnFoerLeggTil)?.forEach((navn) => { if (isSameDay(new Date(navn?.gyldigFraOgMed), new Date(selected))) { diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pensjon/form/validation.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pensjon/form/validation.tsx index c93ca5653f8..7eb2d94482a 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pensjon/form/validation.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pensjon/form/validation.tsx @@ -50,8 +50,7 @@ const getAlder = (values, personFoerLeggTil, importPersoner) => { return alder } -const invalidAlderFom = (inntektFom, values) => { - const personFoerLeggTil = values.personFoerLeggTil +const invalidAlderFom = (inntektFom, values, personFoerLeggTil) => { const importPersoner = values.importPersoner const alder = getAlder(values, personFoerLeggTil, importPersoner) @@ -81,8 +80,7 @@ const invalidAlderFom = (inntektFom, values) => { return false } -const invalidAlderTom = (inntektTom, values) => { - const personFoerLeggTil = values?.personFoerLeggTil +const invalidAlderTom = (inntektTom, values, personFoerLeggTil) => { const importPersoner = values?.importPersoner const alder = getAlder(values, personFoerLeggTil, importPersoner) @@ -106,8 +104,7 @@ const invalidAlderTom = (inntektTom, values) => { return false } -const invalidDoedsdato = (inntektTom, values) => { - const personFoerLeggTil = values.personFoerLeggTil +const invalidDoedsdato = (inntektTom, values, personFoerLeggTil) => { const importPersoner = values.importPersoner let doedsdato = values?.pdldata?.person?.doedsfall?.[0]?.doedsdato @@ -141,8 +138,9 @@ const validFomDateTest = (val: Yup.NumberSchema) => { const inntektFom = value const values = context.parent + const personFoerLeggTil = context?.options?.context?.personFoerLeggTil - if (invalidAlderFom(inntektFom, values)) { + if (invalidAlderFom(inntektFom, values, personFoerLeggTil)) { return context.createError({ message: 'F.o.m kan tidligst være året personen fyller 17 år' }) } @@ -161,14 +159,15 @@ const validTomDateTest = (val: Yup.NumberSchema) => { let inntektTom = value const values = context.parent + const personFoerLeggTil = context?.options?.context?.personFoerLeggTil - if (invalidAlderTom(inntektTom, values)) { + if (invalidAlderTom(inntektTom, values, personFoerLeggTil)) { return context.createError({ message: 'T.o.m kan ikke være etter året personen fyller 75', }) } - if (invalidDoedsdato(inntektTom, values)) { + if (invalidDoedsdato(inntektTom, values, personFoerLeggTil)) { return context.createError({ message: 'T.o.m kan ikke være etter at person har dødd' }) } diff --git a/apps/dolly-frontend/src/main/js/src/components/layout/header/FinnPersonDropdown.tsx b/apps/dolly-frontend/src/main/js/src/components/layout/header/FinnPersonDropdown.tsx index b09517f06b7..0a7f706faa2 100644 --- a/apps/dolly-frontend/src/main/js/src/components/layout/header/FinnPersonDropdown.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/layout/header/FinnPersonDropdown.tsx @@ -8,7 +8,10 @@ const DropdownToggle = () => { const context = useContext(DropdownContext) const { isOpen } = context const location = useLocation() - const isFinnPerson = location?.pathname === '/dollysoek' || location?.pathname === '/testnorge' + const isFinnPerson = + location?.pathname === '/dollysoek' || + location?.pathname === '/testnorge' || + location?.pathname === '/tenor/personer/' return ( { Søk i Tenor + navigate('/nyansettelser/')} + style={{ color: '#212529' }} + > + + Vis nyansettelser + diff --git a/apps/dolly-frontend/src/main/js/src/components/ui/form/inputs/select/Select.tsx b/apps/dolly-frontend/src/main/js/src/components/ui/form/inputs/select/Select.tsx index d5b3ea5ca83..4b0b59d77f9 100644 --- a/apps/dolly-frontend/src/main/js/src/components/ui/form/inputs/select/Select.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/ui/form/inputs/select/Select.tsx @@ -85,35 +85,37 @@ export const Select = ({ } return ( - ({ ...base, zIndex: 99999 }) }} - // Naar vi bruker modal fra Aksel maa vi referere til modalens className for at dropdowns ikke skal forsvinne bak modalen - menuPortalTarget={ - isInDialog - ? (document.getElementsByClassName('navds-modal')[0] as HTMLElement) - : document.getElementById('react-select-root') - } - menuPosition={isInDialog ? 'fixed' : undefined} - {...rest} - /> + + ({ ...base, zIndex: 99999 }) }} + // Naar vi bruker modal fra Aksel maa vi referere til modalens className for at dropdowns ikke skal forsvinne bak modalen + menuPortalTarget={ + isInDialog + ? (document.getElementsByClassName('navds-modal')[0] as HTMLElement) + : document.getElementById('react-select-root') + } + menuPosition={isInDialog ? 'fixed' : undefined} + {...rest} + /> + ) } diff --git a/apps/dolly-frontend/src/main/js/src/components/ui/icon/Icon.tsx b/apps/dolly-frontend/src/main/js/src/components/ui/icon/Icon.tsx index bb641c02e7e..f87447e9516 100644 --- a/apps/dolly-frontend/src/main/js/src/components/ui/icon/Icon.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/ui/icon/Icon.tsx @@ -47,6 +47,7 @@ import { PersonGroupFillIcon, PersonGroupIcon, PersonIcon, + PersonPlusIcon, PersonTallShortIcon, PhoneIcon, PlusCircleIcon, @@ -173,6 +174,7 @@ export const icons = { 'file-new': FileTextIcon, 'file-code': FileCodeIcon, cv: FileTextIcon, + ansettelse: PersonPlusIcon, } const px = (v: number) => `${v}px` diff --git a/apps/dolly-frontend/src/main/js/src/pages/nyansettelser/NyansettelserPage.tsx b/apps/dolly-frontend/src/main/js/src/pages/nyansettelser/NyansettelserPage.tsx new file mode 100644 index 00000000000..111abe76b58 --- /dev/null +++ b/apps/dolly-frontend/src/main/js/src/pages/nyansettelser/NyansettelserPage.tsx @@ -0,0 +1,109 @@ +import React, { useState } from 'react' +import { Alert, Box, Pagination, Table, VStack } from '@navikt/ds-react' +import { useLevendeArbeidsforholdLogg } from '@/utils/hooks/useLevendeArbeidsforhold' +import { formatDate } from '@/utils/DataFormatter' +import { ArbeidKodeverk } from '@/config/kodeverk' +import { useKodeverk } from '@/utils/hooks/useKodeverk' +import { NyansettelserSoek } from '@/pages/nyansettelser/NyansettelserSoek' +import Loading from '@/components/ui/loading/Loading' +import { DollyCopyButton } from '@/components/ui/button/CopyButton/DollyCopyButton' + +export default () => { + const { loggData, loading, error } = useLevendeArbeidsforholdLogg(0, 1000, 'id,DESC') + + const [identSoekData, setIdentSoekData] = useState(null) + const [orgnummerSoekData, setOrgnummerSoekData] = useState(null) + + const [page, setPage] = useState(1) + const rowsPerPage = 10 + + const visData = () => { + if (identSoekData) { + return identSoekData + } else if (orgnummerSoekData) { + return orgnummerSoekData + } else { + return loggData?.content + } + } + + let sortData = visData() + sortData = sortData?.slice((page - 1) * rowsPerPage, page * rowsPerPage) + + const { kodeverk } = useKodeverk(ArbeidKodeverk.Arbeidsforholdstyper) + + return ( + <> +

Nyansettelser

+ + + + {loading ? ( + + ) : !sortData || sortData?.length < 1 ? ( + Fant ingen arbeidsforhold + ) : ( +
+ + + Ident + Org.nr. + Ansatt fra + Arbeidsforholdtype + Stillingsprosent + + + {sortData?.map((row: any, idx: number) => { + return ( + + + { + + } + + + { + + } + + {formatDate(row.ansattfra)} + + {kodeverk?.length > 0 + ? kodeverk?.find((kode: any) => kode?.value === row.arbeidsforholdType) + ?.label + : row.arbeidsforholdType} + + {row.stillingsprosent} + + ) + })} + +
+ {loggData?.content?.length > rowsPerPage && ( + + )} +
+ )} +
+
+ + ) +} diff --git a/apps/dolly-frontend/src/main/js/src/pages/nyansettelser/NyansettelserSoek.tsx b/apps/dolly-frontend/src/main/js/src/pages/nyansettelser/NyansettelserSoek.tsx new file mode 100644 index 00000000000..bea622bdbde --- /dev/null +++ b/apps/dolly-frontend/src/main/js/src/pages/nyansettelser/NyansettelserSoek.tsx @@ -0,0 +1,85 @@ +import { Box, Search, ToggleGroup } from '@navikt/ds-react' +import React, { useState } from 'react' +import { PersonIcon, TenancyIcon } from '@navikt/aksel-icons' +import { Form, FormProvider, useForm } from 'react-hook-form' +import { getIdentUrl, getOrgnummerUrl } from '@/utils/hooks/useLevendeArbeidsforhold' +import Request from '@/service/services/Request' + +enum SoekKategorier { + IDENT = 'ident', + ORGNR = 'orgnr', +} + +export const NyansettelserSoek = ({ setIdentSoekData, setOrgnummerSoekData, setPage }: any) => { + const [soekKategori, setSoekKategori] = useState(SoekKategorier.IDENT) + const [soekValue, setSoekValue] = useState(null) + + const onSubmit = async () => { + if (!soekValue) { + nullstill() + return + } + if (soekKategori === SoekKategorier.ORGNR) { + await Request.get(getOrgnummerUrl(soekValue)).then((response: any) => { + setOrgnummerSoekData(response.data) + setPage(1) + }) + } else { + await Request.get(getIdentUrl(soekValue)).then((response: any) => { + setIdentSoekData(response.data) + setPage(1) + }) + } + } + + const formMethods = useForm({ + mode: 'onSubmit', + }) + + const nullstill = () => { + setSoekValue(null) + setIdentSoekData(null) + setOrgnummerSoekData(null) + setPage(1) + } + + return ( + + setSoekKategori(kategori)} + size="small" + > + } + label="Søk etter personident" + /> + } + label="Søk etter organisasjonsnummer" + /> + + +
+
+ { + value ? setSoekValue(value) : setSoekValue(null) + }} + onClear={nullstill} + /> +
+
+
+
+ ) +} diff --git a/apps/dolly-frontend/src/main/js/src/pages/tenorSoek/resultatVisning/MalValg.tsx b/apps/dolly-frontend/src/main/js/src/pages/tenorSoek/resultatVisning/MalValg.tsx index b783e47e505..8bc62c45299 100644 --- a/apps/dolly-frontend/src/main/js/src/pages/tenorSoek/resultatVisning/MalValg.tsx +++ b/apps/dolly-frontend/src/main/js/src/pages/tenorSoek/resultatVisning/MalValg.tsx @@ -15,7 +15,7 @@ const MalValgWrapper = styled.div` ` const getBrukerOptions = (malbestillinger: any) => - Object.keys(malbestillinger).map((ident) => ({ + Object.keys(malbestillinger)?.map((ident) => ({ value: ident, label: ident, })) @@ -24,7 +24,7 @@ const getMalOptions = (malbestillinger: any, bruker: any) => { if (!malbestillinger || !malbestillinger[bruker]) { return [] } - return malbestillinger[bruker].map((mal: any) => ({ + return malbestillinger?.[bruker]?.map((mal: any) => ({ value: mal.id, label: mal.malNavn, data: { bestilling: mal.bestilling, malNavn: mal.malNavn }, diff --git a/apps/dolly-frontend/src/main/js/src/utils/hooks/useLevendeArbeidsforhold.tsx b/apps/dolly-frontend/src/main/js/src/utils/hooks/useLevendeArbeidsforhold.tsx new file mode 100644 index 00000000000..77fea55bba7 --- /dev/null +++ b/apps/dolly-frontend/src/main/js/src/utils/hooks/useLevendeArbeidsforhold.tsx @@ -0,0 +1,26 @@ +import useSWR from 'swr' +import { fetcher } from '@/api' + +const levenedeArbeidsforholdUrl = '/testnav-levende-arbeidsforhold-ansettelse/api/v1/logg' + +export const getIdentUrl = (ident: string) => { + return `${levenedeArbeidsforholdUrl}/ident/${ident}` +} + +export const getOrgnummerUrl = (orgnummer: string) => { + return `${levenedeArbeidsforholdUrl}/organisasjon/${orgnummer}` +} + +const getLoggUrl = (page: number, size: number, sort: string) => { + return `${levenedeArbeidsforholdUrl}?page=${page}&size=${size}&sort=${sort}` +} + +export const useLevendeArbeidsforholdLogg = (page: number, size: number, sort: string) => { + const { data, isLoading, error } = useSWR(getLoggUrl(page, size, sort), fetcher) + + return { + loggData: data, + loading: isLoading, + error: error, + } +} diff --git a/apps/dolly-frontend/src/main/js/vite.config.js b/apps/dolly-frontend/src/main/js/vite.config.js index 0ebcdf15a30..8b1c1784efd 100644 --- a/apps/dolly-frontend/src/main/js/vite.config.js +++ b/apps/dolly-frontend/src/main/js/vite.config.js @@ -51,6 +51,7 @@ export default defineConfig(({ mode }) => ({ external: ['./nais.js'], }, }, + optimizeDeps: { exclude: ['node_modules/.cache'] }, resolve: { alias: { '@': path.resolve(__dirname, './src'), diff --git a/apps/generer-organisasjon-populasjon-service/build.gradle b/apps/generer-organisasjon-populasjon-service/build.gradle index 9c1768c82f4..a3fccd570c7 100644 --- a/apps/generer-organisasjon-populasjon-service/build.gradle +++ b/apps/generer-organisasjon-populasjon-service/build.gradle @@ -36,6 +36,7 @@ dependencies { implementation "io.confluent:kafka-avro-serializer:$versions.avro" implementation "jakarta.validation:jakarta.validation-api:$versions.jakartaValidation" implementation 'org.flywaydb:flyway-core' + implementation 'org.flywaydb:flyway-database-postgresql' implementation 'com.h2database:h2' implementation 'com.zaxxer:HikariCP' diff --git a/apps/generer-organisasjon-populasjon-service/config.yml b/apps/generer-organisasjon-populasjon-service/config.yml index f67f0d39469..1ae836178b8 100644 --- a/apps/generer-organisasjon-populasjon-service/config.yml +++ b/apps/generer-organisasjon-populasjon-service/config.yml @@ -31,6 +31,7 @@ spec: gcp: sqlInstances: - type: POSTGRES_12 + tier: db-custom-1-3840 databases: - name: testnav-generer-organisasjon-populasjon-db liveness: diff --git a/apps/inntektsmelding-service/build.gradle b/apps/inntektsmelding-service/build.gradle index 67622313baa..1f291182f3a 100644 --- a/apps/inntektsmelding-service/build.gradle +++ b/apps/inntektsmelding-service/build.gradle @@ -30,6 +30,7 @@ dependencies { implementation 'org.apache.commons:commons-io:1.3.2' implementation 'org.flywaydb:flyway-core' + implementation 'org.flywaydb:flyway-database-postgresql' implementation 'com.h2database:h2' implementation 'org.postgresql:postgresql' } diff --git a/apps/inntektsmelding-service/config.yml b/apps/inntektsmelding-service/config.yml index fd15925e7dd..0f8e457ab54 100644 --- a/apps/inntektsmelding-service/config.yml +++ b/apps/inntektsmelding-service/config.yml @@ -35,6 +35,7 @@ spec: gcp: sqlInstances: - type: POSTGRES_12 + tier: db-custom-1-3840 databases: - name: testnav-inntektsmelding-service-db liveness: diff --git a/apps/kodeverk-service/build.gradle b/apps/kodeverk-service/build.gradle index 4aeeb607350..56d1d5fe8fc 100644 --- a/apps/kodeverk-service/build.gradle +++ b/apps/kodeverk-service/build.gradle @@ -12,17 +12,26 @@ sonarqube { dependencies { implementation 'no.nav.testnav.libs:security-core' + implementation 'no.nav.testnav.libs:servlet-core' implementation 'no.nav.testnav.libs:reactive-core' - implementation 'no.nav.testnav.libs:reactive-security' + implementation 'no.nav.testnav.libs:servlet-insecure-security' implementation 'no.nav.testnav.libs:data-transfer-objects' - implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server' + implementation 'org.springframework.boot:spring-boot-starter-web' + implementation 'org.springframework.boot:spring-boot-starter-oauth2-client' + implementation 'org.springframework.boot:spring-boot-starter-security' - implementation 'org.springframework.boot:spring-boot-starter-cache' + implementation 'org.springframework.cloud:spring-cloud-starter-vault-config' + implementation 'org.springframework.boot:spring-boot-starter-actuator' - implementation "org.springdoc:springdoc-openapi-starter-webflux-ui:$versions.springdoc" + implementation 'io.micrometer:micrometer-registry-prometheus' + implementation "org.springdoc:springdoc-openapi-starter-webmvc-ui:$versions.springdoc" implementation "io.swagger.core.v3:swagger-annotations-jakarta:$versions.swagger" + implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server' + + implementation 'org.springframework.boot:spring-boot-starter-cache' + implementation 'com.github.ben-manes.caffeine:caffeine' } diff --git a/apps/kodeverk-service/settings.gradle b/apps/kodeverk-service/settings.gradle index b0f70bc2265..7b680dfe7ba 100644 --- a/apps/kodeverk-service/settings.gradle +++ b/apps/kodeverk-service/settings.gradle @@ -7,8 +7,9 @@ rootProject.name = 'kodeverk-service' includeBuild "../../plugins/java" includeBuild '../../libs/data-transfer-objects' +includeBuild '../../libs/servlet-core' includeBuild '../../libs/reactive-core' -includeBuild '../../libs/reactive-security' +includeBuild '../../libs/servlet-insecure-security' includeBuild '../../libs/security-core' develocity { diff --git a/apps/kodeverk-service/src/main/java/no/nav/testnav/kodeverkservice/config/AppConfig.java b/apps/kodeverk-service/src/main/java/no/nav/testnav/kodeverkservice/config/AppConfig.java index d5872c6c2cf..c852de3e91a 100644 --- a/apps/kodeverk-service/src/main/java/no/nav/testnav/kodeverkservice/config/AppConfig.java +++ b/apps/kodeverk-service/src/main/java/no/nav/testnav/kodeverkservice/config/AppConfig.java @@ -1,14 +1,14 @@ package no.nav.testnav.kodeverkservice.config; -import no.nav.testnav.libs.reactivecore.config.CoreConfig; -import no.nav.testnav.libs.reactivesecurity.config.SecureOAuth2ServerToServerConfiguration; +import no.nav.testnav.libs.servletcore.config.ApplicationCoreConfig; +import no.nav.testnav.libs.standalone.servletsecurity.config.InsecureJwtServerToServerConfiguration; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; @Configuration @Import({ - CoreConfig.class, - SecureOAuth2ServerToServerConfiguration.class + ApplicationCoreConfig.class, + InsecureJwtServerToServerConfiguration.class }) public class AppConfig { } diff --git a/apps/kodeverk-service/src/main/java/no/nav/testnav/kodeverkservice/config/OpenApiConfig.java b/apps/kodeverk-service/src/main/java/no/nav/testnav/kodeverkservice/config/OpenApiConfig.java index 61352dbec8d..e80ff3fbcfe 100644 --- a/apps/kodeverk-service/src/main/java/no/nav/testnav/kodeverkservice/config/OpenApiConfig.java +++ b/apps/kodeverk-service/src/main/java/no/nav/testnav/kodeverkservice/config/OpenApiConfig.java @@ -7,19 +7,16 @@ import io.swagger.v3.oas.models.info.License; import io.swagger.v3.oas.models.security.SecurityRequirement; import io.swagger.v3.oas.models.security.SecurityScheme; -import no.nav.testnav.libs.reactivecore.config.ApplicationProperties; +import no.nav.testnav.libs.servletcore.config.ApplicationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.http.HttpHeaders; -import org.springframework.web.server.ServerWebExchange; -import org.springframework.web.server.WebFilter; -import org.springframework.web.server.WebFilterChain; -import reactor.core.publisher.Mono; +import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import java.util.Arrays; @Configuration -public class OpenApiConfig implements WebFilter { +public class OpenApiConfig implements WebMvcConfigurer { @Bean public OpenAPI openApi(ApplicationProperties applicationProperties) { @@ -29,7 +26,7 @@ public OpenAPI openApi(ApplicationProperties applicationProperties) { .scheme("bearer") .bearerFormat("JWT") .in(SecurityScheme.In.HEADER) - .name(HttpHeaders.AUTHORIZATION) + .name("Authorization") )) .addSecurityItem( new SecurityRequirement().addList("bearer-jwt", Arrays.asList("read", "write"))) @@ -51,15 +48,7 @@ public OpenAPI openApi(ApplicationProperties applicationProperties) { } @Override - public Mono filter(ServerWebExchange exchange, WebFilterChain chain) { - if (exchange.getRequest().getURI().getPath().equals("/swagger")) { - return chain - .filter(exchange.mutate() - .request(exchange.getRequest() - .mutate().path("/swagger-ui.html").build()) - .build()); - } - - return chain.filter(exchange); + public void addViewControllers(ViewControllerRegistry registry) { + registry.addViewController("/swagger").setViewName("redirect:/swagger-ui.html"); } } \ No newline at end of file diff --git a/apps/kodeverk-service/src/main/java/no/nav/testnav/kodeverkservice/config/SecurityConfig.java b/apps/kodeverk-service/src/main/java/no/nav/testnav/kodeverkservice/config/SecurityConfig.java index 20c8c0c96af..be2ddd5da90 100644 --- a/apps/kodeverk-service/src/main/java/no/nav/testnav/kodeverkservice/config/SecurityConfig.java +++ b/apps/kodeverk-service/src/main/java/no/nav/testnav/kodeverkservice/config/SecurityConfig.java @@ -1,38 +1,37 @@ package no.nav.testnav.kodeverkservice.config; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import no.nav.testnav.libs.reactivesecurity.manager.JwtReactiveAuthenticationManager; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.security.config.annotation.method.configuration.EnableReactiveMethodSecurity; -import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity; -import org.springframework.security.config.web.server.ServerHttpSecurity; -import org.springframework.security.web.server.SecurityWebFilterChain; +import org.springframework.context.annotation.Profile; +import org.springframework.security.config.Customizer; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer; +import org.springframework.security.config.http.SessionCreationPolicy; +import org.springframework.security.web.SecurityFilterChain; -@Slf4j +@EnableWebSecurity @Configuration -@EnableWebFluxSecurity -@EnableReactiveMethodSecurity -@RequiredArgsConstructor +@Profile({ "prod", "dev" }) public class SecurityConfig { - private final JwtReactiveAuthenticationManager jwtReactiveAuthenticationManager; - @Bean - public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity httpSecurity) { - return httpSecurity - .csrf(ServerHttpSecurity.CsrfSpec::disable) - .authorizeExchange(authorizeConfig -> authorizeConfig.pathMatchers( + public SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Exception { + + httpSecurity.sessionManagement(sessionConfig -> sessionConfig.sessionCreationPolicy(SessionCreationPolicy.STATELESS)) + .csrf(AbstractHttpConfigurer::disable) + .authorizeHttpRequests(authorizeConfig -> authorizeConfig.requestMatchers( "/internal/**", "/webjars/**", + "/swagger-resources/**", "/v3/api-docs/**", "/swagger-ui/**", "/swagger", "/error", "/swagger-ui.html" - ).permitAll().anyExchange().authenticated()) - .oauth2ResourceServer(oauth2RSConfig -> oauth2RSConfig.jwt(jwtSpec -> jwtSpec.authenticationManager(jwtReactiveAuthenticationManager))) - .build(); + ).permitAll().requestMatchers("/api/**").fullyAuthenticated()) + .oauth2ResourceServer(oauth2RSConfig -> oauth2RSConfig.jwt(Customizer.withDefaults())); + + return httpSecurity.build(); } -} \ No newline at end of file +} diff --git a/apps/kodeverk-service/src/main/java/no/nav/testnav/kodeverkservice/consumer/KodeverkConsumer.java b/apps/kodeverk-service/src/main/java/no/nav/testnav/kodeverkservice/consumer/KodeverkConsumer.java index d8ec625f15a..0365ecc0250 100644 --- a/apps/kodeverk-service/src/main/java/no/nav/testnav/kodeverkservice/consumer/KodeverkConsumer.java +++ b/apps/kodeverk-service/src/main/java/no/nav/testnav/kodeverkservice/consumer/KodeverkConsumer.java @@ -4,8 +4,8 @@ import no.nav.testnav.kodeverkservice.consumer.command.KodeverkGetCommand; import no.nav.testnav.kodeverkservice.dto.KodeverkBetydningerResponse; import no.nav.testnav.kodeverkservice.utility.FilterUtility; -import no.nav.testnav.libs.reactivesecurity.exchange.TokenExchange; import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange; import org.springframework.stereotype.Service; import org.springframework.web.reactive.function.client.ExchangeStrategies; import org.springframework.web.reactive.function.client.WebClient; diff --git a/apps/levende-arbeidsforhold-ansettelse/config.yml b/apps/levende-arbeidsforhold-ansettelse/config.yml index cf0b33f207b..646435be968 100644 --- a/apps/levende-arbeidsforhold-ansettelse/config.yml +++ b/apps/levende-arbeidsforhold-ansettelse/config.yml @@ -54,14 +54,14 @@ spec: - "https://testnav-levende-arbeidsforhold-ansettelse.intern.dev.nav.no" gcp: sqlInstances: - - autoBackupHour: 3 #Lager backup av hele SQL instancen hver dag kl 03:00 - type: POSTGRES_14 + - type: POSTGRES_14 + tier: db-custom-1-3840 databases: - name: testnav-levende-arbeidsforhold-db insights: enabled: true recordApplicationTags: true recordClientAddress: true - tier: db-f1-micro diskAutoresize: true #Kanskje ikke nødvendig? + autoBackupHour: 3 #Lager backup av hele SQL instancen hver dag kl 03:00 #collation: DESC \ No newline at end of file diff --git a/apps/levende-arbeidsforhold-ansettelse/src/main/java/no/nav/registre/testnorge/levendearbeidsforholdansettelse/controller/AnsettelseController.java b/apps/levende-arbeidsforhold-ansettelse/src/main/java/no/nav/registre/testnorge/levendearbeidsforholdansettelse/controller/AnsettelseController.java new file mode 100644 index 00000000000..c4f8a9d88d8 --- /dev/null +++ b/apps/levende-arbeidsforhold-ansettelse/src/main/java/no/nav/registre/testnorge/levendearbeidsforholdansettelse/controller/AnsettelseController.java @@ -0,0 +1,26 @@ +package no.nav.registre.testnorge.levendearbeidsforholdansettelse.controller; + +import io.swagger.v3.oas.annotations.Operation; +import lombok.RequiredArgsConstructor; +import no.nav.registre.testnorge.levendearbeidsforholdansettelse.service.AnsettelseService; +import org.springframework.http.HttpStatus; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseStatus; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/api/v1/ansettelse") +@RequiredArgsConstructor +public class AnsettelseController { + + private final AnsettelseService ansettelseService; + + @PostMapping + @ResponseStatus(HttpStatus.OK) + @Operation(description = "Starter en eksekvering på oppretting av arbeidsforhold") + public void executeAnsettelser() { + + ansettelseService.runAnsettelseService(); + } +} diff --git a/apps/levende-arbeidsforhold-ansettelse/src/main/java/no/nav/registre/testnorge/levendearbeidsforholdansettelse/controller/LoggController.java b/apps/levende-arbeidsforhold-ansettelse/src/main/java/no/nav/registre/testnorge/levendearbeidsforholdansettelse/controller/LoggController.java new file mode 100644 index 00000000000..a7439989573 --- /dev/null +++ b/apps/levende-arbeidsforhold-ansettelse/src/main/java/no/nav/registre/testnorge/levendearbeidsforholdansettelse/controller/LoggController.java @@ -0,0 +1,43 @@ +package no.nav.registre.testnorge.levendearbeidsforholdansettelse.controller; + +import io.swagger.v3.oas.annotations.Operation; +import lombok.RequiredArgsConstructor; +import no.nav.registre.testnorge.levendearbeidsforholdansettelse.entity.AnsettelseLogg; +import no.nav.registre.testnorge.levendearbeidsforholdansettelse.service.LoggService; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@RestController +@RequestMapping("/api/v1/logg") +@RequiredArgsConstructor +public class LoggController { + + private final LoggService loggService; + + @GetMapping + @Operation(description = "Henter logger i hht forespørsel") + public Page getAnsettelser(Pageable pageable) { + + return loggService.getAnsettelseLogg(pageable); + } + + @GetMapping("/ident/{ident}") + @Operation(description = "Henter logg i hht forespørsel") + public List getIdent(@PathVariable String ident) { + + return loggService.getIdent(ident); + } + + @GetMapping("/organisasjon/{orgnummer}") + @Operation(description = "Henter logg i hht forespørsel") + public List getOrganisasjon(@PathVariable String orgnummer) { + + return loggService.getOrgnummer(orgnummer); + } +} diff --git a/apps/levende-arbeidsforhold-ansettelse/src/main/java/no/nav/registre/testnorge/levendearbeidsforholdansettelse/controller/ParameterController.java b/apps/levende-arbeidsforhold-ansettelse/src/main/java/no/nav/registre/testnorge/levendearbeidsforholdansettelse/controller/ParameterController.java new file mode 100644 index 00000000000..131c6c4535e --- /dev/null +++ b/apps/levende-arbeidsforhold-ansettelse/src/main/java/no/nav/registre/testnorge/levendearbeidsforholdansettelse/controller/ParameterController.java @@ -0,0 +1,55 @@ +package no.nav.registre.testnorge.levendearbeidsforholdansettelse.controller; + + +import io.swagger.v3.oas.annotations.Operation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import no.nav.registre.testnorge.levendearbeidsforholdansettelse.entity.JobbParameter; +import no.nav.registre.testnorge.levendearbeidsforholdansettelse.service.ParameterService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseStatus; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@Slf4j +@RestController +@RequestMapping("/api/v1/parameter") +@RequiredArgsConstructor +public class ParameterController { + + @Autowired + private final ParameterService parameterService; + + /** + * Endepunktet som blir benyttet av frontend for å hente alle parameterene og verdiene + * @return returnerer parameterne + */ + @GetMapping + @Operation(description = "Henter alle parametre for oppretting av arbeidsforhold") + @ResponseStatus(HttpStatus.OK) + public ResponseEntity> hentAlleParametere() { + + return ResponseEntity.ok(parameterService.hentAlleParametere()); + } + + /** + * Endepunktet frontenden bruker for å opdatere gjeldende verdi i jobb_parameter db. + * @param parameternavn navnet på parameteren som skal bli oppdatert + * @param verdi ER den nye verdien som skal bli oppdatert + */ + @PutMapping("/{parameternavn}") + @Operation(description = "Legg inn ny verdi på en parameter") + @ResponseStatus(HttpStatus.OK) + public void oppdatereVerdier(@PathVariable("parameternavn") String parameternavn, @RequestBody String verdi){ + + parameterService.updateVerdi(parameternavn, verdi); + } +} diff --git a/apps/levende-arbeidsforhold-ansettelse/src/main/java/no/nav/registre/testnorge/levendearbeidsforholdansettelse/entity/AnsettelseLogg.java b/apps/levende-arbeidsforhold-ansettelse/src/main/java/no/nav/registre/testnorge/levendearbeidsforholdansettelse/entity/AnsettelseLogg.java new file mode 100644 index 00000000000..e69de29bb2d diff --git a/apps/levende-arbeidsforhold-ansettelse/src/main/java/no/nav/registre/testnorge/levendearbeidsforholdansettelse/repository/AnsettelseLoggRepository.java b/apps/levende-arbeidsforhold-ansettelse/src/main/java/no/nav/registre/testnorge/levendearbeidsforholdansettelse/repository/AnsettelseLoggRepository.java new file mode 100644 index 00000000000..e69de29bb2d diff --git a/apps/levende-arbeidsforhold-ansettelse/src/main/java/no/nav/registre/testnorge/levendearbeidsforholdansettelse/repository/LoggRepository.java b/apps/levende-arbeidsforhold-ansettelse/src/main/java/no/nav/registre/testnorge/levendearbeidsforholdansettelse/repository/LoggRepository.java new file mode 100644 index 00000000000..9ff58517749 --- /dev/null +++ b/apps/levende-arbeidsforhold-ansettelse/src/main/java/no/nav/registre/testnorge/levendearbeidsforholdansettelse/repository/LoggRepository.java @@ -0,0 +1,7 @@ +package no.nav.registre.testnorge.levendearbeidsforholdansettelse.repository; + +import no.nav.registre.testnorge.levendearbeidsforholdansettelse.entity.AnsettelseLogg; +import org.springframework.data.repository.PagingAndSortingRepository; + +public interface LoggRepository extends PagingAndSortingRepository { +} diff --git a/apps/levende-arbeidsforhold-ansettelse/src/main/java/no/nav/registre/testnorge/levendearbeidsforholdansettelse/repository/ParameterRepository.java b/apps/levende-arbeidsforhold-ansettelse/src/main/java/no/nav/registre/testnorge/levendearbeidsforholdansettelse/repository/ParameterRepository.java new file mode 100644 index 00000000000..e69de29bb2d diff --git a/apps/levende-arbeidsforhold-ansettelse/src/main/java/no/nav/registre/testnorge/levendearbeidsforholdansettelse/service/AnsettelseService.java b/apps/levende-arbeidsforhold-ansettelse/src/main/java/no/nav/registre/testnorge/levendearbeidsforholdansettelse/service/AnsettelseService.java new file mode 100644 index 00000000000..e69de29bb2d diff --git a/apps/levende-arbeidsforhold-ansettelse/src/main/java/no/nav/registre/testnorge/levendearbeidsforholdansettelse/service/ArbeidsforholdService.java b/apps/levende-arbeidsforhold-ansettelse/src/main/java/no/nav/registre/testnorge/levendearbeidsforholdansettelse/service/ArbeidsforholdService.java new file mode 100644 index 00000000000..e69de29bb2d diff --git a/apps/levende-arbeidsforhold-ansettelse/src/main/java/no/nav/registre/testnorge/levendearbeidsforholdansettelse/service/util/AlderspennList.java b/apps/levende-arbeidsforhold-ansettelse/src/main/java/no/nav/registre/testnorge/levendearbeidsforholdansettelse/service/util/AlderspennList.java new file mode 100644 index 00000000000..e69de29bb2d diff --git a/apps/levende-arbeidsforhold-ansettelse/src/main/java/no/nav/registre/testnorge/levendearbeidsforholdansettelse/service/util/AliasMethod.java b/apps/levende-arbeidsforhold-ansettelse/src/main/java/no/nav/registre/testnorge/levendearbeidsforholdansettelse/service/util/AliasMethod.java new file mode 100644 index 00000000000..e69de29bb2d diff --git a/apps/organisasjon-bestilling-service/build.gradle b/apps/organisasjon-bestilling-service/build.gradle index d0f03b0b23a..7d6eccd8cc8 100644 --- a/apps/organisasjon-bestilling-service/build.gradle +++ b/apps/organisasjon-bestilling-service/build.gradle @@ -28,6 +28,7 @@ dependencies { implementation 'com.h2database:h2' implementation 'com.zaxxer:HikariCP' implementation 'org.flywaydb:flyway-core' + implementation 'org.flywaydb:flyway-database-postgresql' implementation 'org.postgresql:postgresql' implementation "org.springdoc:springdoc-openapi-starter-webmvc-ui:$versions.springdoc" diff --git a/apps/organisasjon-bestilling-service/config.yml b/apps/organisasjon-bestilling-service/config.yml index 085a993d852..1db95994502 100644 --- a/apps/organisasjon-bestilling-service/config.yml +++ b/apps/organisasjon-bestilling-service/config.yml @@ -41,6 +41,7 @@ spec: gcp: sqlInstances: - type: POSTGRES_12 + tier: db-custom-1-3840 databases: - name: organisasjon-bestilling-db liveness: diff --git a/apps/organisasjon-faste-data-service/build.gradle b/apps/organisasjon-faste-data-service/build.gradle index adb4ef27310..f7c5315e881 100644 --- a/apps/organisasjon-faste-data-service/build.gradle +++ b/apps/organisasjon-faste-data-service/build.gradle @@ -32,6 +32,7 @@ dependencies { implementation "io.confluent:kafka-avro-serializer:$versions.avro" implementation 'org.flywaydb:flyway-core' + implementation 'org.flywaydb:flyway-database-postgresql' implementation 'com.zaxxer:HikariCP' implementation 'com.h2database:h2' implementation 'org.postgresql:postgresql' diff --git a/apps/organisasjon-faste-data-service/config.yml b/apps/organisasjon-faste-data-service/config.yml index 2355acdee86..c81abd891ef 100644 --- a/apps/organisasjon-faste-data-service/config.yml +++ b/apps/organisasjon-faste-data-service/config.yml @@ -41,6 +41,7 @@ spec: gcp: sqlInstances: - type: POSTGRES_12 + tier: db-custom-1-3840 databases: - name: testnav-organisasjon-faste-data-db liveness: diff --git a/apps/organisasjon-faste-data-service/src/main/java/no/nav/registre/testnorge/organisasjonfastedataservice/consumer/OrganisasjonMottakConsumer.java b/apps/organisasjon-faste-data-service/src/main/java/no/nav/registre/testnorge/organisasjonfastedataservice/consumer/OrganisasjonMottakConsumer.java index 650b4f83dd4..88c6e648aec 100644 --- a/apps/organisasjon-faste-data-service/src/main/java/no/nav/registre/testnorge/organisasjonfastedataservice/consumer/OrganisasjonMottakConsumer.java +++ b/apps/organisasjon-faste-data-service/src/main/java/no/nav/registre/testnorge/organisasjonfastedataservice/consumer/OrganisasjonMottakConsumer.java @@ -1,5 +1,6 @@ package no.nav.registre.testnorge.organisasjonfastedataservice.consumer; +import io.swagger.v3.core.util.Json; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import no.nav.registre.testnorge.organisasjonfastedataservice.domain.Adresse; @@ -12,11 +13,14 @@ import no.nav.testnav.libs.avro.organisasjon.v1.Opprettelsesdokument; import no.nav.testnav.libs.kafkaproducers.organisasjon.v2.EndringsdokumentV2Producer; import no.nav.testnav.libs.kafkaproducers.organisasjon.v2.OpprettelsesdokumentV2Producer; +import org.apache.avro.AvroRuntimeException; import org.springframework.stereotype.Component; import java.util.Optional; import java.util.stream.Collectors; +import static java.util.Objects.isNull; + @Slf4j @Component @RequiredArgsConstructor @@ -66,34 +70,44 @@ private no.nav.testnav.libs.avro.organisasjon.v1.Organisasjon create(Organisasjo Optional.ofNullable(organisasjon.getEpost()) .ifPresent(value -> builder.setEpostBuilder(Epost.newBuilder().setEpost(value))); - return builder - .setOrgnummer(organisasjon.getOrgnummer()) - .setEnhetstype(organisasjon.getEnhetstype()) - .setNavnBuilder(DetaljertNavn - .newBuilder() - .setNavn1(organisasjon.getNavn()) - .setRedigertNavn(organisasjon.getRedigertNavn()) - ) - .setUnderenheter(organisasjon.getUnderenheter().stream().map(this::create).collect(Collectors.toList())) - .setPostadresse(create(organisasjon.getPostadresse())) - .setForretningsadresse(create(organisasjon.getForretningsAdresse())) - .build(); + try { + return builder + .setOrgnummer(organisasjon.getOrgnummer()) + .setEnhetstype(organisasjon.getEnhetstype()) + .setNavnBuilder(DetaljertNavn + .newBuilder() + .setNavn1(organisasjon.getNavn()) + .setRedigertNavn(organisasjon.getRedigertNavn()) + ) + .setUnderenheter(organisasjon.getUnderenheter().stream().map(this::create).collect(Collectors.toList())) + .setPostadresse(create(organisasjon.getPostadresse())) + .setForretningsadresse(create(organisasjon.getForretningsAdresse())) + .build(); + } catch (AvroRuntimeException e) { + log.error("Feil ved mapping av organisasjon: {}", Json.pretty(organisasjon), e); + throw e; + } } private no.nav.testnav.libs.avro.organisasjon.v1.Adresse create(Adresse adresse) { - if (adresse == null) { + if (isNull(adresse) || isNull(adresse.getPostnr())) { return null; } - return no.nav.testnav.libs.avro.organisasjon.v1.Adresse.newBuilder() - .setPostadresse1(adresse.getAdresselinje1()) - .setPostadresse2(adresse.getAdresselinje2()) - .setPostadresse3(adresse.getAdresselinje3()) - .setKommunenummer(adresse.getKommunenr()) - .setPoststed(adresse.getPoststed()) - .setPostnummer(adresse.getPostnr()) - .setLandkode(adresse.getLandkode()) - .build(); + try { + return no.nav.testnav.libs.avro.organisasjon.v1.Adresse.newBuilder() + .setPostadresse1(adresse.getAdresselinje1()) + .setPostadresse2(adresse.getAdresselinje2()) + .setPostadresse3(adresse.getAdresselinje3()) + .setKommunenummer(adresse.getKommunenr()) + .setPoststed(adresse.getPoststed()) + .setPostnummer(adresse.getPostnr()) + .setLandkode(adresse.getLandkode()) + .build(); + } catch (AvroRuntimeException e) { + log.error("Feil ved mapping av adresse: {}", Json.pretty(adresse), e); + throw e; + } } -} +} \ No newline at end of file diff --git a/apps/organisasjon-forvalter/build.gradle b/apps/organisasjon-forvalter/build.gradle index 03052c5a3ec..50db6abb5e5 100644 --- a/apps/organisasjon-forvalter/build.gradle +++ b/apps/organisasjon-forvalter/build.gradle @@ -36,6 +36,7 @@ dependencies { implementation "org.apache.avro:avro:$versions.apacheAvro" implementation 'org.flywaydb:flyway-core' + implementation 'org.flywaydb:flyway-database-postgresql' implementation 'org.postgresql:postgresql' implementation "org.springdoc:springdoc-openapi-starter-webmvc-ui:$versions.springdoc" diff --git a/apps/organisasjon-forvalter/config.yml b/apps/organisasjon-forvalter/config.yml index 390a7622548..7f3a63fd166 100644 --- a/apps/organisasjon-forvalter/config.yml +++ b/apps/organisasjon-forvalter/config.yml @@ -46,6 +46,7 @@ spec: gcp: sqlInstances: - type: POSTGRES_12 + tier: db-custom-1-3840 databases: - name: organisasjon-forvalter-db liveness: diff --git a/apps/organisasjon-tilgang-service/build.gradle b/apps/organisasjon-tilgang-service/build.gradle index 3989bbbfd80..6e7f58f08af 100644 --- a/apps/organisasjon-tilgang-service/build.gradle +++ b/apps/organisasjon-tilgang-service/build.gradle @@ -20,6 +20,7 @@ dependencies { implementation 'io.r2dbc:r2dbc-h2' implementation 'org.postgresql:r2dbc-postgresql' implementation 'org.flywaydb:flyway-core' + implementation 'org.flywaydb:flyway-database-postgresql' implementation "ma.glasnost.orika:orika-core:$versions.orika" diff --git a/apps/organisasjon-tilgang-service/config.yml b/apps/organisasjon-tilgang-service/config.yml index b28d6a6364f..0e3f4e5af6b 100644 --- a/apps/organisasjon-tilgang-service/config.yml +++ b/apps/organisasjon-tilgang-service/config.yml @@ -66,6 +66,7 @@ spec: gcp: sqlInstances: - type: POSTGRES_15 + tier: db-custom-1-3840 name: testnav-organisasjon-tilganger databases: - name: testnav-organisasjon-tilganger diff --git a/apps/orgnummer-service/build.gradle b/apps/orgnummer-service/build.gradle index 1a79299b6c6..250446959fa 100644 --- a/apps/orgnummer-service/build.gradle +++ b/apps/orgnummer-service/build.gradle @@ -26,6 +26,7 @@ dependencies { implementation "jakarta.validation:jakarta.validation-api:$versions.jakartaValidation" implementation 'org.flywaydb:flyway-core' + implementation 'org.flywaydb:flyway-database-postgresql' implementation 'com.h2database:h2' implementation 'com.zaxxer:HikariCP' diff --git a/apps/orgnummer-service/config.yml b/apps/orgnummer-service/config.yml index 815bd5b8b0c..941ece0203e 100644 --- a/apps/orgnummer-service/config.yml +++ b/apps/orgnummer-service/config.yml @@ -62,6 +62,7 @@ spec: gcp: sqlInstances: - type: POSTGRES_14 + tier: db-custom-1-3840 name: testnav-orgnummer-pool databases: - name: testnav-orgnummer-pool diff --git a/apps/pdl-forvalter/build.gradle b/apps/pdl-forvalter/build.gradle index abdf9719dab..2857450a8eb 100644 --- a/apps/pdl-forvalter/build.gradle +++ b/apps/pdl-forvalter/build.gradle @@ -37,6 +37,7 @@ dependencies { implementation 'org.postgresql:postgresql' implementation 'org.flywaydb:flyway-core' + implementation 'org.flywaydb:flyway-database-postgresql' implementation "com.fasterxml.jackson.core:jackson-core:$versions.jackson" diff --git a/apps/pdl-forvalter/config.test.yml b/apps/pdl-forvalter/config.test.yml index 0fdbdd271c0..b7fbbc88ca0 100644 --- a/apps/pdl-forvalter/config.test.yml +++ b/apps/pdl-forvalter/config.test.yml @@ -68,5 +68,6 @@ spec: gcp: sqlInstances: - type: POSTGRES_12 + tier: db-custom-1-3840 databases: - name: testnav-pdl-forvalter-dev-db diff --git a/apps/pdl-forvalter/config.yml b/apps/pdl-forvalter/config.yml index 479f3130e6b..7de5d7ac372 100644 --- a/apps/pdl-forvalter/config.yml +++ b/apps/pdl-forvalter/config.yml @@ -66,6 +66,6 @@ spec: gcp: sqlInstances: - type: POSTGRES_12 + tier: db-custom-1-3840 databases: - name: testnav-pdl-forvalter-db - tier: db-custom-2-3840 diff --git a/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/service/IdenttypeService.java b/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/service/IdenttypeService.java index dc7183c8a96..10265016515 100644 --- a/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/service/IdenttypeService.java +++ b/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/service/IdenttypeService.java @@ -7,6 +7,7 @@ import no.nav.pdl.forvalter.exception.InvalidRequestException; import no.nav.pdl.forvalter.exception.NotFoundException; import no.nav.pdl.forvalter.utils.DatoFraIdentUtility; +import no.nav.pdl.forvalter.utils.FoedselsdatoUtility; import no.nav.pdl.forvalter.utils.IdenttypeUtility; import no.nav.pdl.forvalter.utils.KjoennFraIdentUtility; import no.nav.pdl.forvalter.utils.SyntetiskFraIdentUtility; @@ -67,7 +68,7 @@ public PersonDTO convert(PersonDTO person) { if (isTrue(type.getIsNew())) { - type.setFoedtEtter(person.getFoedsel().getFirst().getFoedselsdato().plusDays(index + 1L)); + type.setFoedtEtter(FoedselsdatoUtility.getFoedselsdato(person).plusDays(index + 1L)); nyPerson = handle(type, nyPerson); type.setKilde(getKilde(type)); diff --git a/apps/person-faste-data-service/build.gradle b/apps/person-faste-data-service/build.gradle index 745a0854d4d..7051cd1700b 100644 --- a/apps/person-faste-data-service/build.gradle +++ b/apps/person-faste-data-service/build.gradle @@ -21,6 +21,8 @@ dependencies { implementation 'org.springframework.cloud:spring-cloud-starter-bootstrap' // TODO remove legacy bootstrap config implementation 'org.flywaydb:flyway-core' + implementation 'org.flywaydb:flyway-database-postgresql' + implementation 'com.h2database:h2' implementation 'com.zaxxer:HikariCP' implementation 'org.postgresql:postgresql' diff --git a/apps/person-faste-data-service/config.yml b/apps/person-faste-data-service/config.yml index 30f870b7643..d3ac0945c18 100644 --- a/apps/person-faste-data-service/config.yml +++ b/apps/person-faste-data-service/config.yml @@ -29,6 +29,7 @@ spec: gcp: sqlInstances: - type: POSTGRES_12 + tier: db-custom-1-3840 databases: - name: testnav-person-faste-data-db liveness: diff --git a/apps/testnav-ident-pool/build.gradle b/apps/testnav-ident-pool/build.gradle index 0bb3e37d932..f1bd50720e7 100644 --- a/apps/testnav-ident-pool/build.gradle +++ b/apps/testnav-ident-pool/build.gradle @@ -35,6 +35,7 @@ dependencies { implementation 'com.h2database:h2' implementation 'org.flywaydb:flyway-core' + implementation 'org.flywaydb:flyway-database-postgresql' implementation 'org.postgresql:postgresql' implementation "ma.glasnost.orika:orika-core:$versions.orika" diff --git a/apps/testnav-ident-pool/config.yml b/apps/testnav-ident-pool/config.yml index a548195be12..7d6c7d73de4 100644 --- a/apps/testnav-ident-pool/config.yml +++ b/apps/testnav-ident-pool/config.yml @@ -62,8 +62,8 @@ spec: gcp: sqlInstances: - type: POSTGRES_14 + tier: db-custom-1-3840 name: testnav-identpool databases: - name: testnav-identpool - tier: db-custom-1-3840 autoBackupHour: 2 \ No newline at end of file diff --git a/apps/testnorge-statisk-data-forvalter/build.gradle b/apps/testnorge-statisk-data-forvalter/build.gradle index 6dd8cd066e7..e05f2943d50 100644 --- a/apps/testnorge-statisk-data-forvalter/build.gradle +++ b/apps/testnorge-statisk-data-forvalter/build.gradle @@ -39,6 +39,7 @@ dependencies { implementation 'com.zaxxer:HikariCP' implementation 'org.flywaydb:flyway-core' + implementation 'org.flywaydb:flyway-database-postgresql' implementation 'com.h2database:h2' diff --git a/apps/udi-stub/build.gradle b/apps/udi-stub/build.gradle index b9afdb2c571..0a8aca55b93 100644 --- a/apps/udi-stub/build.gradle +++ b/apps/udi-stub/build.gradle @@ -41,6 +41,7 @@ dependencies { implementation 'org.postgresql:postgresql' implementation 'org.flywaydb:flyway-core' + implementation 'org.flywaydb:flyway-database-postgresql' implementation 'com.zaxxer:HikariCP' implementation "ma.glasnost.orika:orika-core:$versions.orika" diff --git a/apps/varslinger-service/build.gradle b/apps/varslinger-service/build.gradle index 1735ab74ece..1d73768f5a4 100644 --- a/apps/varslinger-service/build.gradle +++ b/apps/varslinger-service/build.gradle @@ -32,6 +32,7 @@ dependencies { implementation 'com.h2database:h2' implementation 'com.zaxxer:HikariCP' implementation 'org.flywaydb:flyway-core' + implementation 'org.flywaydb:flyway-database-postgresql' implementation 'org.postgresql:postgresql' testImplementation 'org.springframework.cloud:spring-cloud-contract-wiremock' diff --git a/apps/varslinger-service/config.test.yml b/apps/varslinger-service/config.test.yml index fb7e3aa2584..578b41794e6 100644 --- a/apps/varslinger-service/config.test.yml +++ b/apps/varslinger-service/config.test.yml @@ -26,6 +26,7 @@ spec: gcp: sqlInstances: - type: POSTGRES_12 + tier: db-custom-1-3840 databases: - name: testnav-varslinger-db-dev liveness: diff --git a/apps/varslinger-service/config.yml b/apps/varslinger-service/config.yml index 96701cd321d..ffbadc98742 100644 --- a/apps/varslinger-service/config.yml +++ b/apps/varslinger-service/config.yml @@ -27,6 +27,7 @@ spec: gcp: sqlInstances: - type: POSTGRES_12 + tier: db-custom-1-3840 databases: - name: testnav-varslinger-db liveness: diff --git a/examples/reactive-rest-example/build.gradle b/examples/reactive-rest-example/build.gradle index 27ed8451880..ea04abc3846 100644 --- a/examples/reactive-rest-example/build.gradle +++ b/examples/reactive-rest-example/build.gradle @@ -24,6 +24,7 @@ dependencies { implementation 'io.r2dbc:r2dbc-h2' implementation 'org.postgresql:r2dbc-postgresql' implementation 'org.flywaydb:flyway-core' + implementation 'org.flywaydb:flyway-database-postgresql' runtimeOnly 'org.postgresql:postgresql' runtimeOnly 'com.h2database:h2' diff --git a/libs/database/build.gradle b/libs/database/build.gradle index 4c3f4f3d551..a41ac47cec6 100644 --- a/libs/database/build.gradle +++ b/libs/database/build.gradle @@ -16,4 +16,5 @@ dependencies { implementation 'org.springframework.cloud:spring-cloud-vault-config-databases' implementation 'org.springframework.cloud:spring-cloud-starter-vault-config' implementation 'org.flywaydb:flyway-core' + implementation 'org.flywaydb:flyway-database-postgresql' } diff --git a/libs/servlet-security/src/main/java/no/nav/testnav/libs/servletsecurity/action/GetUserInfo.java b/libs/servlet-security/src/main/java/no/nav/testnav/libs/servletsecurity/action/GetUserInfo.java index 9d1399ab534..52a7b4cdcff 100644 --- a/libs/servlet-security/src/main/java/no/nav/testnav/libs/servletsecurity/action/GetUserInfo.java +++ b/libs/servlet-security/src/main/java/no/nav/testnav/libs/servletsecurity/action/GetUserInfo.java @@ -25,7 +25,10 @@ public GetUserInfo(@Value("${JWT_SECRET:#{null}}") String secret) { @Override public Optional call() { - var request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + + var requestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); + + var request = requestAttributes.getRequest(); log.trace("Prøver å hente JWT fra request..."); return Optional.ofNullable(request.getHeader(UserConstant.USER_HEADER_JWT)).map(token -> { log.trace("Fant JWT i request."); diff --git a/plugins/java/src/main/groovy/dolly-versions.gradle b/plugins/java/src/main/groovy/dolly-versions.gradle index 27445a6f0da..ac8c48bf5e4 100644 --- a/plugins/java/src/main/groovy/dolly-versions.gradle +++ b/plugins/java/src/main/groovy/dolly-versions.gradle @@ -4,17 +4,17 @@ class DollyVersionCatalog { String navAltinnInntektsmelding = "1.2019.08.16-13.46-35cbdfd492d4" String navFellesregister = "2020.08.27-09.53-183ead3d81eb" - String springBoot = "3.2.1" - String springCloud = "2023.0.1" - String springSession = "2021.2.3" + String springBoot = "3.3.2" + String springSession = "3.3.1" + String springCloud = "2023.0.3" String apacheAvro = "1.11.3" String apacheKafka = "3.7.0" - String apachePoi = "5.2.5" + String apachePoi = "5.3.0" String assertj = "3.26.0" String avro = "7.6.1" String guava = "33.2.0-jre" - String jackson = "2.17.1" + String jackson = "2.17.2" String jakartaActivation = "2.1.3" String jakartaValidation = "3.1.0" String jakartaXmlBindApi = "4.0.2" @@ -24,13 +24,13 @@ class DollyVersionCatalog { String jaxws = "4.0.2" String jweaver = "1.9.22" String jwt = "4.4.0" - String logback = "7.4" + String logback = "8.0" String mq = "3.2.3" String okhttp = "4.10.0" - String opensearch = "1.4.0" + String opensearch = "1.5.1" String orika = "1.5.4" String reactorSpring = "1.0.1.RELEASE" - String reactorTest = "3.6.5" + String reactorTest = "3.6.8" String springdoc = "2.5.0" - String swagger = "2.2.21" + String swagger = "2.2.22" } \ No newline at end of file