-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
77 additions
and
3 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
src/main/kotlin/no/nav/sifinnsynapi/forvaltning/AktørBytteController.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package no.nav.sifinnsynapi.forvaltning | ||
|
||
import no.nav.security.token.support.core.api.ProtectedWithClaims | ||
import no.nav.security.token.support.core.api.RequiredIssuers | ||
import no.nav.sifinnsynapi.common.AktørId | ||
import no.nav.sifinnsynapi.config.Issuers | ||
import no.nav.sifinnsynapi.soknad.SøknadService | ||
import org.springframework.http.MediaType | ||
import org.springframework.http.ResponseEntity | ||
import org.springframework.web.bind.annotation.PostMapping | ||
import org.springframework.web.bind.annotation.RequestBody | ||
import org.springframework.web.bind.annotation.RestController | ||
|
||
@RestController | ||
@RequiredIssuers( | ||
ProtectedWithClaims(issuer = Issuers.TOKEN_X, claimMap = ["acr=Level4"]) | ||
) | ||
class AktørBytteController( | ||
private val søknadService: SøknadService | ||
) { | ||
|
||
@PostMapping("forvaltning/oppdaterAktoerId", | ||
produces = [MediaType.APPLICATION_JSON_VALUE]) | ||
fun oppdaterAktoerId(@RequestBody aktørBytteRequest: AktørBytteRequest): ResponseEntity<AktørBytteRespons> { | ||
val antallOppdaterte = søknadService.oppdaterAktørId( | ||
AktørId(aktørBytteRequest.gyldigAktør), | ||
AktørId(aktørBytteRequest.utgåttAktør) | ||
) | ||
return ResponseEntity.ok(AktørBytteRespons(antallOppdaterte)) | ||
} | ||
|
||
|
||
} |
19 changes: 19 additions & 0 deletions
19
src/main/kotlin/no/nav/sifinnsynapi/forvaltning/AktørBytteRequest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package no.nav.sifinnsynapi.forvaltning | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty | ||
import jakarta.validation.constraints.Pattern | ||
import jakarta.validation.constraints.Size | ||
import org.jetbrains.annotations.NotNull | ||
|
||
data class AktørBytteRequest( | ||
@JsonProperty | ||
@NotNull | ||
@Size(max = 20) | ||
@Pattern(regexp = "^\\d+$", message = "AktørId [\${validatedValue}] matcher ikke tillatt pattern [{regexp}]") | ||
val utgåttAktør: String, | ||
@JsonProperty | ||
@NotNull | ||
@Size(max = 20) | ||
@Pattern(regexp = "^\\d+$", message = "AktørId [\${validatedValue}] matcher ikke tillatt pattern [{regexp}]") | ||
val gyldigAktør: String | ||
) |
13 changes: 13 additions & 0 deletions
13
src/main/kotlin/no/nav/sifinnsynapi/forvaltning/AktørBytteRespons.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package no.nav.sifinnsynapi.forvaltning | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty | ||
import jakarta.validation.constraints.Pattern | ||
import jakarta.validation.constraints.Size | ||
import org.jetbrains.annotations.NotNull | ||
|
||
data class AktørBytteRespons( | ||
@JsonProperty | ||
@NotNull | ||
val antallOppdaterteRader: Int, | ||
|
||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters