Skip to content

Commit

Permalink
Fix after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
torchr89 committed Oct 27, 2023
1 parent 2bc0f2e commit 254c712
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 15 deletions.
1 change: 0 additions & 1 deletion src/main/kotlin/no/nav/syfo/api/AktivitetspliktApi.kt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,5 @@ class AktivitetspliktApi(
reason = "Ingen aktivitetskrav funnet",
loglevel = LogLevel.OFF
)

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package no.nav.syfo.exception
import org.springframework.http.HttpStatus
import org.springframework.web.bind.annotation.ResponseStatus


@ResponseStatus(value = HttpStatus.NOT_FOUND)
internal class ResourceNotFoundException(message: String, httpStatus: HttpStatus, reason: String, loglevel: LogLevel) :
AbstractApiError(
Expand Down
19 changes: 7 additions & 12 deletions src/main/kotlin/no/nav/syfo/persistence/AktivitetskravDAO.kt
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package no.nav.syfo.persistence

import no.nav.syfo.api.dto.Aktivitetsplikt
import no.nav.syfo.kafka.consumer.domain.KAktivitetskravVarsel
import no.nav.syfo.kafka.consumer.domain.KAktivitetskravVurdering
import org.springframework.dao.EmptyResultDataAccessException
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.databind.SerializationFeature
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule
import com.fasterxml.jackson.module.kotlin.registerKotlinModule
import no.nav.syfo.api.dto.Aktivitetsplikt
import no.nav.syfo.kafka.consumer.domain.DocumentComponentDTO
import no.nav.syfo.kafka.consumer.domain.KAktivitetskravVarsel
import no.nav.syfo.kafka.consumer.domain.KAktivitetskravVurdering
import no.nav.syfo.service.domain.AktivitetskravVurdering
import org.springframework.dao.EmptyResultDataAccessException
import org.springframework.jdbc.core.JdbcTemplate
import org.springframework.jdbc.core.RowMapper
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource
Expand Down Expand Up @@ -78,7 +78,7 @@ class AktivitetskravDAO(
return namedParameterJdbcTemplate.update(lagreSql, mapLagreSql)
}

fun storeAktivitetkravVarsel(varsel: KAktivitetskravVarsel) {
fun storeAktivitetkravVarsel(varsel: KAktivitetskravVarsel): Int {
val uuid = UUID.randomUUID()
val lagreSql = """
INSERT INTO AKTIVITETSKRAV_VARSEL (
Expand Down Expand Up @@ -114,9 +114,8 @@ class AktivitetskravDAO(
.addValue("svarfrist", varsel.svarfrist.toDate())
.addValue("document", varsel.document.documentsToStr())
.addValue("vurdering_uuid", varsel.vurderingUuid)
namedParameterJdbcTemplate.update(lagreSql, mapLagreSql)
return namedParameterJdbcTemplate.update(lagreSql, mapLagreSql)
}
<<<<<<< HEAD

fun getAktivitetsplikt(fnr: String): Aktivitetsplikt? {
val query = """
Expand All @@ -136,13 +135,10 @@ class AktivitetskravDAO(
} catch (e: EmptyResultDataAccessException) {
null
}
=======
fun fetchAktivitetkravVurderingByIdent(personIdent: String): List<AktivitetskravVurdering> {
return jdbcTemplate.query("SELECT * FROM aktivitetskrav_vurdering WHERE person_ident = ?", aktivitetskravVurderingRowMapper, personIdent)
}

companion object {
private val aktivitetskravVurderingRowMapper: RowMapper<AktivitetskravVurdering>
val aktivitetskravVurderingRowMapper: RowMapper<AktivitetskravVurdering>
get() = RowMapper { rs: ResultSet, _: Int ->
AktivitetskravVurdering(
uuid = UUID.fromString(rs.getString("uuid")),
Expand Down Expand Up @@ -174,6 +170,5 @@ class AktivitetskravDAO(
fun List<String>.toStr() = this.joinToString(separator = ",").trim()

fun List<DocumentComponentDTO>.documentsToStr() = jsonWriter.writeValueAsString(this)
>>>>>>> 09437da (Basic DB unit test)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class AktivitetspliktRowMapper : RowMapper<Aktivitetsplikt> {
arsaker = arsaker?.split(",") ?: emptyList(),
sistVurdert = sistVurdert?.toZonedLocalDateTime(),
fristDato = fristDato?.toZonedLocalDateTime(),
journalpostId = journalpostId,
journalpostId = journalpostId
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package no.nav.syfo.persistence
import io.kotest.inspectors.forAll
import io.kotest.matchers.shouldBe
import no.nav.syfo.LocalApplication
import no.nav.syfo.service.domain.AktivitetskravVurdering
import no.nav.syfo.testutil.EmbeddedDatabase
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.extension.ExtendWith
Expand Down Expand Up @@ -37,3 +38,7 @@ class AktivitietskravDAOTest @Autowired constructor(
.forAll { it.personIdent shouldBe FNR_1 }
}
}

fun AktivitetskravDAO.fetchAktivitetkravVurderingByIdent(personIdent: String): List<AktivitetskravVurdering> {
return jdbcTemplate.query("SELECT * FROM aktivitetskrav_vurdering WHERE person_ident = ?", AktivitetskravDAO.aktivitetskravVurderingRowMapper, personIdent)
}

0 comments on commit 254c712

Please sign in to comment.