Skip to content

Commit

Permalink
hmm
Browse files Browse the repository at this point in the history
  • Loading branch information
JulieHillRoa committed Oct 11, 2023
1 parent 44f45ad commit ee8479f
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,27 +30,29 @@ public class PersonController {

private final RegistreringService registreringService;


@Deprecated
@GetMapping("/aktorid")
public AktoerId aktorid(@RequestParam("fnr") Fnr fnr) {
authService.stoppHvisEksternBruker();
authService.sjekkLesetilgang(fnr);
return new AktoerId(authService.getAktorId(fnr));
}

@Deprecated
@GetMapping("/navn")
@Operation(summary = "Henter navnet til en person")
public PersonNavn navn(@RequestParam(value = "fnr", required = false) Fnr fnr) {
throw new ResponseStatusException(HttpStatus.GONE, "Bytt til v2 endepunkt");
}

@Deprecated
@GetMapping("/{fodselsnummer}/malform")
@Operation(summary = "Henter målform til en person")
public Malform malform(@PathVariable("fodselsnummer") Fnr fnr) {
throw new ResponseStatusException(HttpStatus.GONE,
"Bytt til v2 endepunkt");
}

@Deprecated
@GetMapping("/{fodselsnummer}/tilgangTilBruker")
public boolean tilgangTilBruker(@PathVariable("fodselsnummer") Fnr fodselsnummer) {
return authService.harLesetilgang(fodselsnummer);
Expand All @@ -67,18 +69,21 @@ public HarLoggetInnRespons harNivaa4(@PathVariable("fodselsnummer") Fnr fodselsn
.setPersonidentifikator(fodselsnummer);
}

@Deprecated
@GetMapping("/geografisktilknytning")
public GeografiskTilknytning geografisktilknytning(@RequestParam(value = "fnr", required = false) Fnr fnr) {
Fnr fodselsnummer = hentIdentForEksternEllerIntern(fnr);
authService.sjekkLesetilgang(fodselsnummer);
return personV2Service.hentGeografiskTilknytning(fodselsnummer);
}

@Deprecated
@GetMapping("/cv_jobbprofil")
public ResponseEntity<String> cvOgJobbprofil(@RequestParam(value = "fnr", required = false) Fnr fnr) {
return cvJobbprofilService.hentCvJobbprofilJson(fnr);
}

@Deprecated
@GetMapping("/registrering")
public ResponseEntity<String> registrering(@RequestParam(value = "fnr") Fnr fnr) {
authService.stoppHvisEksternBruker();
Expand All @@ -88,7 +93,7 @@ public ResponseEntity<String> registrering(@RequestParam(value = "fnr") Fnr fnr)

@PostMapping("/registrering/endringer")
public ResponseEntity<String> endringIRegistreringdata(@RequestBody PersonRequestBody personRequestBody) {
Fnr fnr = personRequestBody.fnr();
Fnr fnr = Fnr.of(personRequestBody.fodselsnummer());
authService.stoppHvisEksternBruker();
authService.sjekkLesetilgang(fnr);
return registreringService.hentEndringIRegistreringsdata(fnr);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,92 +34,90 @@ public class PersonV3Controller {

private final RegistreringService registreringService;

@PostMapping
@Operation(summary = "Henter informasjon om en person fra PDL")
public PersonV2Data hentPerson(@RequestBody PersonRequest personRequest) {
authService.stoppHvisEksternBruker();
authService.sjekkLesetilgang(personRequest.getFnr());
return personV2Service.hentFlettetPerson(personRequest.getFnr());
}
@PostMapping("/aktorid")
public AktoerId aktorid(@RequestBody PersonRequestBody personRequestBody) {
public AktoerId aktorid(@RequestBody PersonRequest personRequest) {
authService.stoppHvisEksternBruker();
Fnr fnr = personRequestBody.fnr();
authService.sjekkLesetilgang(fnr);
return new AktoerId(authService.getAktorId(fnr));
authService.sjekkLesetilgang(personRequest.getFnr());
return new AktoerId(authService.getAktorId(personRequest.getFnr()));
}

@PostMapping("/tilgangTilBruker")
public boolean tilgangTilBruker(@RequestBody PersonRequestBody personRequestBody) {
return authService.harLesetilgang(personRequestBody.fnr());
public boolean tilgangTilBruker(@RequestBody PersonRequest personRequest) {
return authService.harLesetilgang(personRequest.getFnr());
}
@GetMapping("/geografisktilknytning")
public GeografiskTilknytning geografisktilknytning(@RequestBody PersonRequestBody personRequestBody) {
Fnr fodselsnummer = hentIdentForEksternEllerIntern(personRequestBody.fnr());
public GeografiskTilknytning geografisktilknytning(@RequestBody PersonRequest personRequest) {
Fnr fodselsnummer = hentIdentForEksternEllerIntern(personRequest.getFnr());
authService.sjekkLesetilgang(fodselsnummer);
return personV2Service.hentGeografiskTilknytning(fodselsnummer);
}

@GetMapping("/cv_jobbprofil")
public ResponseEntity<String> cvOgJobbprofil(@RequestBody PersonRequestBody personRequestBody) {
return cvJobbprofilService.hentCvJobbprofilJson(personRequestBody.fnr());
public ResponseEntity<String> cvOgJobbprofil(@RequestBody PersonRequest personRequest) {
return cvJobbprofilService.hentCvJobbprofilJson(personRequest.getFnr());
}

@GetMapping("/registrering")
public ResponseEntity<String> registrering(@RequestBody PersonRequestBody personRequestBody) {
public ResponseEntity<String> registrering(@RequestBody PersonRequest personRequest) {
authService.stoppHvisEksternBruker();
Fnr fnr = personRequestBody.fnr();
authService.sjekkLesetilgang(fnr);
return registreringService.hentRegistrering(fnr);
authService.sjekkLesetilgang(personRequest.getFnr());
return registreringService.hentRegistrering(personRequest.getFnr());
}

@PostMapping
@Operation(summary = "Henter informasjon om en person fra PDL")
public PersonV2Data hentPerson(@RequestBody PersonRequestBody personRequestBody) {
authService.stoppHvisEksternBruker();
Fnr fnr = personRequestBody.fnr();
authService.sjekkLesetilgang(fnr);
return personV2Service.hentFlettetPerson(fnr);
}
@PostMapping("/registrering/endringer")
public ResponseEntity<String> endringIRegistreringdata(@RequestBody PersonRequest personRequest) {
authService.stoppHvisEksternBruker();
authService.sjekkLesetilgang(personRequest.getFnr());
return registreringService.hentEndringIRegistreringsdata(personRequest.getFnr());
}

@PostMapping("/malform")
@Operation(summary = "Henter malform fra DIGDIR tjeneste")
public Malform malform(@RequestBody PersonRequestBody personRequestBody) {
public Malform malform(@RequestBody PersonRequest personRequest) {
authService.stoppHvisEksternBruker();
Fnr fnr = personRequestBody.fnr();
authService.sjekkLesetilgang(fnr);
authService.sjekkLesetilgang(personRequest.getFnr());

String malform = personV2Service.hentMalform(fnr);
String malform = personV2Service.hentMalform(personRequest.getFnr());
return new Malform(malform);
}

@PostMapping("/vergeOgFullmakt")
@Operation(summary = "Henter informasjon om verge og fullmakt for en person fra PDL")
public VergeOgFullmaktData hentVergemaalOgFullmakt(@RequestBody PersonRequestBody personRequestBody) {
public VergeOgFullmaktData hentVergemaalOgFullmakt(@RequestBody PersonRequest personRequest) {
authService.stoppHvisEksternBruker();
Fnr fnr = personRequestBody.fnr();
authService.sjekkLesetilgang(fnr);
return personV2Service.hentVergeEllerFullmakt(fnr);
authService.sjekkLesetilgang(personRequest.getFnr());
return personV2Service.hentVergeEllerFullmakt(personRequest.getFnr());
}

@PostMapping("/tolk")
@Operation(summary = "Henter tolk informajon til en person fra PDL")
public TilrettelagtKommunikasjonData hentSpraakTolk(@RequestBody PersonRequestBody personRequestBody) {
public TilrettelagtKommunikasjonData hentSpraakTolk(@RequestBody PersonRequest personRequest) {
authService.stoppHvisEksternBruker();
Fnr fnr = personRequestBody.fnr();
authService.sjekkLesetilgang(fnr);
return personV2Service.hentSpraakTolkInfo(fnr);
authService.sjekkLesetilgang(personRequest.getFnr());
return personV2Service.hentSpraakTolkInfo(personRequest.getFnr());
}

@PostMapping("/navn")
@Operation(summary = "Henter navn til en person fra PDL")
public PersonNavnV2 hentNavn(@RequestBody PersonRequestBody personRequestBody) {
public PersonNavnV2 hentNavn(@RequestBody PersonRequest personRequest) {
authService.stoppHvisEksternBruker();
Fnr fnr = personRequestBody.fnr();
authService.sjekkLesetilgang(fnr);
return personV2Service.hentNavn(fnr);
authService.sjekkLesetilgang(personRequest.getFnr());
return personV2Service.hentNavn(personRequest.getFnr());
}

@PostMapping("/postadresse")
@Operation(summary = "Henter postadresse til en person fra regoppslag")
public RegoppslagResponseDTO hentPostadresse(@RequestBody PersonRequestBody personRequestBody) {
public RegoppslagResponseDTO hentPostadresse(@RequestBody PersonRequest personRequest) {
authService.stoppHvisEksternBruker();
Fnr fnr = personRequestBody.fnr();
authService.sjekkLesetilgang(fnr);
return regoppslagClient.hentPostadresse(fnr);
authService.sjekkLesetilgang(personRequest.getFnr());
return regoppslagClient.hentPostadresse(personRequest.getFnr());
}
private Fnr hentIdentForEksternEllerIntern(Fnr queryParamFnr) {
Fnr fnr;
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/no/nav/veilarbperson/domain/PersonRequest.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package no.nav.veilarbperson.domain

import no.nav.common.types.identer.Fnr

data class PersonRequest(
val fnr: Fnr
)
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package no.nav.veilarbperson.domain;

import no.nav.common.types.identer.Fnr;

public record PersonRequestBody(
Fnr fnr
String fodselsnummer
) {
}

0 comments on commit ee8479f

Please sign in to comment.