Skip to content

Commit

Permalink
Merge pull request #17 from navikt/add-dokument
Browse files Browse the repository at this point in the history
Add dokument to API
  • Loading branch information
AudunSorheim authored Nov 13, 2023
2 parents ee97e5f + 4478a70 commit 078df96
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/main/kotlin/no/nav/syfo/api/dto/Aktivitetsplikt.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package no.nav.syfo.api.dto

import no.nav.syfo.kafka.consumer.domain.DocumentComponentDTO
import java.time.LocalDateTime

enum class AktivitetspliktStatus {
Expand All @@ -12,4 +13,5 @@ data class Aktivitetsplikt(
val sistVurdert: LocalDateTime?,
val fristDato: LocalDateTime?,
val journalpostId: String?,
val document: List<DocumentComponentDTO>?,
)
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class AktivitetskravDAO(

fun getAktivitetsplikt(fnr: String): Aktivitetsplikt? {
val query = """
SELECT vurdering.status, vurdering.arsaker, vurdering.sist_vurdert, varsel.svarfrist, varsel.journalpost_id
SELECT vurdering.status, vurdering.arsaker, vurdering.sist_vurdert, varsel.svarfrist, varsel.journalpost_id, varsel.document
FROM aktivitetskrav_vurdering vurdering
LEFT JOIN aktivitetskrav_varsel varsel ON vurdering.siste_vurdering_uuid = varsel.vurdering_uuid
WHERE vurdering.person_ident = :person_ident
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package no.nav.syfo.persistence

import com.fasterxml.jackson.module.kotlin.readValue
import no.nav.syfo.api.dto.Aktivitetsplikt
import no.nav.syfo.api.dto.AktivitetspliktStatus
import org.springframework.jdbc.core.RowMapper
Expand All @@ -13,13 +14,15 @@ class AktivitetspliktRowMapper : RowMapper<Aktivitetsplikt> {
val sistVurdert: Timestamp? = rs.getTimestamp("sist_vurdert")
val fristDato: Timestamp? = rs.getTimestamp("svarfrist")
val journalpostId: String? = rs.getString("journalpost_id")
val document: String? = rs.getString("document")

return Aktivitetsplikt(
status = AktivitetspliktStatus.valueOf(status),
arsaker = arsaker?.split(",") ?: emptyList(),
sistVurdert = sistVurdert?.toZonedLocalDateTime(),
fristDato = fristDato?.toZonedLocalDateTime(),
journalpostId = journalpostId
journalpostId = journalpostId,
document = document?.let { jsonWriter.readValue(it) }
)
}
}

0 comments on commit 078df96

Please sign in to comment.