Skip to content

Commit

Permalink
Merge branch 'master' into feature/dolly-frontend-react-hook-form-mig…
Browse files Browse the repository at this point in the history
…ration

# Conflicts:
#	apps/dolly-frontend/src/main/js/package-lock.json
  • Loading branch information
stigus committed Jan 22, 2024
2 parents 08e0346 + e3f8164 commit 9264dd2
Show file tree
Hide file tree
Showing 124 changed files with 186 additions and 230 deletions.
2 changes: 1 addition & 1 deletion apps/adresse-service/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'java'
id "org.sonarqube" version "4.0.0.2929"
id "org.sonarqube" version "4.4.1.3373"
id 'org.springframework.boot' version "3.2.1"
id 'io.spring.dependency-management' version "1.1.4"
id "jacoco"
Expand Down
2 changes: 1 addition & 1 deletion apps/amelding-service/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'java'
id "org.sonarqube" version "4.0.0.2929"
id "org.sonarqube" version "4.4.1.3373"
id 'org.springframework.boot' version "3.2.1"
id 'io.spring.dependency-management' version "1.1.4"
id "jacoco"
Expand Down
2 changes: 1 addition & 1 deletion apps/app-tilgang-analyse-service/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'java'
id "org.sonarqube" version "4.0.0.2929"
id "org.sonarqube" version "4.4.1.3373"
id 'org.springframework.boot' version "3.2.1"
id 'io.spring.dependency-management' version "1.1.4"
id "jacoco"
Expand Down
2 changes: 1 addition & 1 deletion apps/arbeidsforhold-service/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'java'
id "org.sonarqube" version "4.0.0.2929"
id "org.sonarqube" version "4.4.1.3373"
id 'org.springframework.boot' version "3.2.1"
id 'io.spring.dependency-management' version "1.1.4"
id "jacoco"
Expand Down
2 changes: 1 addition & 1 deletion apps/batch-bestilling-service/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'java'
id "org.sonarqube" version "4.0.0.2929"
id "org.sonarqube" version "4.4.1.3373"
id 'org.springframework.boot' version "3.2.1"
id 'io.spring.dependency-management' version "1.1.4"
id "jacoco"
Expand Down
2 changes: 1 addition & 1 deletion apps/brreg-stub/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'java'
id "org.sonarqube" version "4.0.0.2929"
id "org.sonarqube" version "4.4.1.3373"
id "uk.co.boothen.gradle.wsimport" version "0.21"
id 'org.springframework.boot' version "3.2.1"
id 'io.spring.dependency-management' version "1.1.4"
Expand Down
2 changes: 1 addition & 1 deletion apps/bruker-service/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'java'
id "org.sonarqube" version "4.0.0.2929"
id "org.sonarqube" version "4.4.1.3373"
id 'org.springframework.boot' version "3.2.1"
id 'io.spring.dependency-management' version "1.1.4"
id "jacoco"
Expand Down
2 changes: 1 addition & 1 deletion apps/budpro-service/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
id 'org.springframework.boot' version '3.2.1'
id 'io.spring.dependency-management' version '1.1.4'
id "jacoco"
id "org.sonarqube" version "4.0.0.2929"
id "org.sonarqube" version "4.4.1.3373"
id("org.openrewrite.rewrite") version("6.6.4")
}

Expand Down
2 changes: 1 addition & 1 deletion apps/dolly-backend/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'java'
id "org.sonarqube" version "4.0.0.2929"
id "org.sonarqube" version "4.4.1.3373"
id 'org.springframework.boot' version "3.2.1"
id 'io.spring.dependency-management' version "1.1.4"
id "jacoco"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ public Flux<ClientFuture> gjenopprett(RsDollyUtvidetBestilling bestilling, Dolly
return Flux.empty();
}

@Override
public void release(List<String> identer) {

skjermingsRegisterConsumer.deleteSkjerming(identer)
.subscribe(response -> log.info("Slettet identer fra Skjermingsregisteret"));
}

private ClientFuture futurePersist(BestillingProgress progress, String status) {

return () -> {
Expand All @@ -63,13 +70,6 @@ private ClientFuture futurePersist(BestillingProgress progress, String status) {
};
}

@Override
public void release(List<String> identer) {

skjermingsRegisterConsumer.deleteSkjerming(identer)
.subscribe(response -> log.info("Slettet identer fra Skjermingsregisteret"));
}

private String getStatus(SkjermingDataResponse resultat) {

return isBlank(resultat.getError()) ? "OK" :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import no.nav.dolly.bestilling.ConsumerStatus;
import no.nav.dolly.bestilling.skjermingsregister.command.SkjermingsregisterDeleteCommand;
import no.nav.dolly.bestilling.skjermingsregister.command.SkjermingsregisterGetCommand;
import no.nav.dolly.bestilling.skjermingsregister.command.SkjermingsregisterPostCommand;
import no.nav.dolly.bestilling.skjermingsregister.command.SkjermingsregisterPutCommand;
Expand All @@ -19,6 +18,7 @@
import reactor.core.publisher.Mono;

import java.time.Duration;
import java.time.LocalDateTime;
import java.util.List;

import static java.util.Objects.nonNull;
Expand Down Expand Up @@ -47,44 +47,47 @@ public SkjermingsRegisterConsumer(
.build();
}

@Timed(name = "providers", tags = {"operation", "skjermingsdata-slett"})
public Mono<List<Void>> deleteSkjerming(List<String> identer) {
@Timed(name = "providers", tags = { "operation", "skjermingsdata-slett" })
public Mono<List<SkjermingDataResponse>> deleteSkjerming(List<String> identer) {

return tokenService.exchange(serverProperties)
.flatMapMany(token -> Flux.range(0, identer.size())
.delayElements(Duration.ofMillis(100))
.map(index -> new SkjermingsregisterDeleteCommand(webClient,
identer.get(index), token.getTokenValue()).call())
.map(index -> new SkjermingsregisterPutCommand(webClient,
SkjermingDataRequest.builder()
.personident(identer.get(index))
.skjermetTil(LocalDateTime.now())
.build(),
token.getTokenValue()).call())
.flatMap(Flux::from))
.collectList();
}

@Timed(name = "providers", tags = {"operation", "skjermingsdata-oppdater"})
@Timed(name = "providers", tags = { "operation", "skjermingsdata-oppdater" })
public Mono<SkjermingDataResponse> oppdaterPerson(SkjermingDataRequest skjerming) {

return tokenService.exchange(serverProperties)
.flatMap(token -> new SkjermingsregisterGetCommand(webClient, skjerming.getPersonident(), token.getTokenValue()).call()
.flatMap(response -> {
if (isBlank(response.getError())) {
if (response.isEksistererIkke()) {
return new SkjermingsregisterPostCommand(webClient, List.of(skjerming),
return new SkjermingsregisterPostCommand(webClient, skjerming,
token.getTokenValue()).call()
.collectList()
.map(status -> {
log.info("Opprettet skjerming på ident {} fraDato {} tilDato {}",
status.get(0).getPersonident(), status.get(0).getSkjermetFra(), status.get(0).getSkjermetTil());
return status.get(0);
status.getFirst().getPersonident(), status.getFirst().getSkjermetFra(), status.getFirst().getSkjermetTil());
return status.getFirst();
});
} else {
return nonNull(skjerming.getSkjermetTil()) ?

new SkjermingsregisterPutCommand(webClient, skjerming.getPersonident(),
skjerming.getSkjermetTil(), token.getTokenValue()).call()
new SkjermingsregisterPutCommand(webClient, skjerming, token.getTokenValue())
.call()
.map(status -> {
log.info("Oppdatert skjerming for ident {}, ny tilDato {}", skjerming.getPersonident(), skjerming.getSkjermetTil());
return status;
}) :

Mono.just(new SkjermingDataResponse());
}
} else {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
@RequiredArgsConstructor
public class SkjermingsregisterGetCommand implements Callable<Mono<SkjermingDataResponse>> {

private static final String SKJERMINGSREGISTER_URL = "/api/v1/skjermingdata";
private static final String SKJERMINGSREGISTER_URL = "/api/v1/skjerming/dolly";
private static final String PERSONIDENT_HEADER = "personident";

private final WebClient webClient;
private final String ident;
Expand All @@ -26,9 +27,9 @@ public class SkjermingsregisterGetCommand implements Callable<Mono<SkjermingData
public Mono<SkjermingDataResponse> call() {
return webClient.get().uri(uriBuilder -> uriBuilder
.path(SKJERMINGSREGISTER_URL)
.pathSegment(ident)
.build())
.header(AUTHORIZATION, "Bearer " + token)
.header(PERSONIDENT_HEADER, ident)
.retrieve()
.bodyToMono(SkjermingDataResponse.class)
.onErrorResume(WebClientResponseException.NotFound.class::isInstance,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,17 @@
import reactor.util.retry.Retry;

import java.time.Duration;
import java.util.List;
import java.util.concurrent.Callable;

import static org.springframework.http.HttpHeaders.AUTHORIZATION;

@RequiredArgsConstructor
public class SkjermingsregisterPostCommand implements Callable<Flux<SkjermingDataResponse>> {

private static final String SKJERMINGSREGISTER_URL = "/api/v1/skjermingdata";
private static final String SKJERMINGSREGISTER_URL = "/api/v1/skjerming/dolly";

private final WebClient webClient;
private final List<SkjermingDataRequest> skjermingsDataRequest;
private final SkjermingDataRequest skjermingDataRequest;
private final String token;

@Override
Expand All @@ -30,7 +29,7 @@ public Flux<SkjermingDataResponse> call() {
.path(SKJERMINGSREGISTER_URL)
.build())
.header(AUTHORIZATION, "Bearer " + token)
.bodyValue(skjermingsDataRequest)
.bodyValue(skjermingDataRequest)
.retrieve()
.bodyToFlux(SkjermingDataResponse.class)
.onErrorResume(error -> Flux.just(SkjermingDataResponse.builder()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,39 +1,34 @@
package no.nav.dolly.bestilling.skjermingsregister.command;

import lombok.RequiredArgsConstructor;
import no.nav.dolly.bestilling.skjermingsregister.domain.SkjermingDataRequest;
import no.nav.dolly.bestilling.skjermingsregister.domain.SkjermingDataResponse;
import no.nav.testnav.libs.reactivecore.utils.WebClientFilter;
import org.springframework.web.reactive.function.client.WebClient;
import reactor.core.publisher.Mono;
import reactor.util.retry.Retry;

import java.time.Duration;
import java.time.LocalDateTime;
import java.util.concurrent.Callable;

import static java.util.Objects.nonNull;
import static org.springframework.http.HttpHeaders.AUTHORIZATION;

@RequiredArgsConstructor
public class SkjermingsregisterPutCommand implements Callable<Mono<SkjermingDataResponse>> {

private static final String SKJERMINGSREGISTER_URL = "/api/v1/skjermingdata";
private static final String SKJERMINGOPPHOER_URL = SKJERMINGSREGISTER_URL + "/opphor";
private static final String SKJERMING_TOM = "skjermetTil";
private static final String SKJERMINGSREGISTER_URL = "/api/v1/skjerming/dolly";

private final WebClient webClient;
private final String ident;
private final LocalDateTime tilDato;
private final SkjermingDataRequest skjermingsDataRequest;
private final String token;

@Override
public Mono<SkjermingDataResponse> call() {
return webClient.put().uri(uriBuilder -> uriBuilder
.path(SKJERMINGOPPHOER_URL)
.pathSegment(ident)
.queryParam(SKJERMING_TOM, nonNull(tilDato) ? tilDato.toLocalDate() : null)
.path(SKJERMINGSREGISTER_URL)
.build())
.header(AUTHORIZATION, "Bearer " + token)
.bodyValue(skjermingsDataRequest)
.retrieve()
.toBodilessEntity()
.map(result -> SkjermingDataResponse.builder().build())
Expand Down
2 changes: 1 addition & 1 deletion apps/dolly-frontend/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id "org.sonarqube" version "4.0.0.2929"
id "org.sonarqube" version "4.4.1.3373"
id 'java'
id 'org.springframework.boot' version "3.2.1"
id 'io.spring.dependency-management' version "1.1.4"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import Request from '@/service/services/Request'

const skjermingUrl = '/testnav-skjermingsregister-proxy/api/v1/skjermingdata'
const skjermingUrl = '/testnav-skjermingsregister-proxy/api/v1/skjerming/dolly'

export default {
deleteSkjerming(ident: string) {
return Request.delete(`${skjermingUrl}/${ident}`)
return Request.put(skjermingUrl, { personident: ident, skjermetTil: new Date() })
},

getSkjerming(ident: string) {
return Request.get(`${skjermingUrl}/${ident}`)
}
return Request.get(skjermingUrl, { personident: ident })
},
}
2 changes: 1 addition & 1 deletion apps/dollystatus/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'java'
id "org.sonarqube" version "4.0.0.2929"
id "org.sonarqube" version "4.4.1.3373"
id 'org.springframework.boot' version "3.2.1"
id 'io.spring.dependency-management' version "1.1.4"
id "jacoco"
Expand Down
8 changes: 4 additions & 4 deletions apps/dollystatus/src/main/js/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion apps/dollystatus/src/main/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"path-browserify": "^1.0.1",
"prettier": "^3.0.1",
"typescript": "^5.0.2",
"vite": "^5.0.8",
"vite": "^5.0.12",
"vite-plugin-html": "^3.2.0",
"vite-plugin-svgr": "^4.0.0",
"vite-tsconfig-paths": "^4.0.5"
Expand Down
2 changes: 1 addition & 1 deletion apps/endringsmelding-frontend/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'java'
id "org.sonarqube" version "4.0.0.2929"
id "org.sonarqube" version "4.4.1.3373"
id 'org.springframework.boot' version "3.2.1"
id 'io.spring.dependency-management' version "1.1.4"
id "jacoco"
Expand Down
Loading

0 comments on commit 9264dd2

Please sign in to comment.