Skip to content

Commit

Permalink
chore: returning GONE as statuscode with a message if a oppgave is fe…
Browse files Browse the repository at this point in the history
…rdigstilt

Co-authored-by: Andreas <danduras@gmail.com>
  • Loading branch information
jaflaten and andreasDev committed Dec 6, 2024
1 parent 97aec96 commit ec192b1
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import no.nav.sykdig.digitalisering.papirsykmelding.db.model.Utfall
import no.nav.sykdig.digitalisering.pdl.Navn
import no.nav.sykdig.digitalisering.pdl.PersonService
import no.nav.sykdig.securelog
import org.springframework.http.HttpStatus
import org.springframework.http.HttpStatusCode
import org.springframework.http.ResponseEntity
import org.springframework.security.access.prepost.PostAuthorize
Expand Down Expand Up @@ -56,13 +57,13 @@ class NasjonalOppgaveController(
fun getPapirsykmeldingManuellOppgave(
@PathVariable oppgaveId: String,
@RequestHeader("Authorization") authorization: String,
): ResponseEntity<PapirManuellOppgave> {
): ResponseEntity<Any> { // return type i body må være noko anna då? ?????????????????????????????????????????????????????
val papirManuellOppgave = nasjonalOppgaveService.getOppgave(oppgaveId, authorization)

if (papirManuellOppgave != null) {
if(papirManuellOppgave.ferdigstilt) {
log.info("Oppgave med id $oppgaveId er allerede ferdigstilt")
return ResponseEntity.noContent().build()
return ResponseEntity.status(HttpStatus.GONE).body("Oppgave med id $oppgaveId er allerede ferdigstilt")
}
return ResponseEntity.ok(nasjonalOppgaveService.mapFromDao(papirManuellOppgave))
}
Expand Down

0 comments on commit ec192b1

Please sign in to comment.