Skip to content

Commit

Permalink
update status to deleted if it is not found
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasDev committed Jul 19, 2023
1 parent 9f604f8 commit ca07600
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/main/kotlin/no/nav/syfo/model/ManuellOppgave.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ enum class ManuellOppgaveStatus {
APEN,
FERDIGSTILT,
FEILREGISTRERT,
DELETED,
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class UpdateStatusService(
private val statusMap = mapOf(
"FERDIGSTILT" to ManuellOppgaveStatus.FERDIGSTILT,
"FEILREGISTRERT" to ManuellOppgaveStatus.FEILREGISTRERT,
null to ManuellOppgaveStatus.DELETED,
)
}

Expand All @@ -46,13 +47,13 @@ class UpdateStatusService(
val oppgave = oppgaveClient.hentOppgave(oppgaveId, id)
if (oppgave == null) {
logger.warn("Could not find oppgave for oppgaveId $oppgaveId")
} else {
database.oppdaterOppgaveHendelse(
oppgaveId = oppgaveId,
status = statusMap[oppgave.status] ?: ManuellOppgaveStatus.APEN,
statusTimestamp = oppgave.endretTidspunkt?.toLocalDateTime() ?: LocalDateTime.now(),
)
}

database.oppdaterOppgaveHendelse(
oppgaveId = oppgaveId,
status = statusMap[oppgave?.status] ?: ManuellOppgaveStatus.APEN,
statusTimestamp = oppgave?.endretTidspunkt?.toLocalDateTime() ?: LocalDateTime.now(),
)
} catch (ex: Exception) {
logger.error("Caught $ex for oppgaveId $oppgaveId")
}
Expand Down

0 comments on commit ca07600

Please sign in to comment.