Skip to content

Commit

Permalink
kjørt spotlessApply og rettet noen feil manuelt
Browse files Browse the repository at this point in the history
  • Loading branch information
di0nys1us committed Apr 26, 2024
1 parent 808705d commit 30d4add
Show file tree
Hide file tree
Showing 34 changed files with 405 additions and 336 deletions.
28 changes: 17 additions & 11 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.ktor)
alias(libs.plugins.graphql)
// alias(libs.plugins.spotless)
alias(libs.plugins.spotless)
}

application {
Expand Down Expand Up @@ -74,16 +74,22 @@ dependencies {
testImplementation(libs.wiremock)
}

//spotless {
// kotlin {
// ktlint()
// targetExclude("**/generated/**")
// }
// kotlinGradle {
// target("*.gradle.kts")
// ktlint()
// }
//}
spotless {
kotlin {
ktlint().editorConfigOverride(
mapOf(
"ktlint_standard_max-line-length" to "disabled",
"ktlint_standard_value-argument-comment" to "disabled",
"ktlint_standard_value-parameter-comment" to "disabled",
),
)
targetExclude("**/generated/**")
}
kotlinGradle {
target("*.gradle.kts")
ktlint()
}
}

kotlin { jvmToolchain(21) }

Expand Down
5 changes: 2 additions & 3 deletions src/main/kotlin/no/nav/hjelpemidler/soknad/db/Application.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ fun main(args: Array<String>): Unit = io.ktor.server.netty.EngineMain.main(args)
@ExperimentalTime
@Suppress("unused") // Referenced in application.conf
fun Application.module() {

if (!waitForDB(10.minutes, Configuration)) {
throw Exception("database never became available within the deadline")
}
Expand Down Expand Up @@ -86,7 +85,7 @@ fun Application.module() {
ordreStore,
infotrygdStore,
hotsakStore,
metrics
metrics,
)
}

Expand All @@ -97,7 +96,7 @@ fun Application.module() {
ordreStore,
infotrygdStore,
hotsakStore,
metrics
metrics,
)
}
}
Expand Down
12 changes: 7 additions & 5 deletions src/main/kotlin/no/nav/hjelpemidler/soknad/db/Configuration.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ private val localProperties = ConfigurationMap(
"HM_ROLLER_AUDIENCE" to "audience",
"BIGQUERY_DATASET_ID" to "hm_soknadsbehandling_v1_dataset_local",
"GCP_TEAM_PROJECT_ID" to "teamdigihot",
)
),
)
private val devProperties = ConfigurationMap(
mapOf(
Expand All @@ -42,7 +42,7 @@ private val devProperties = ConfigurationMap(
"HM_ROLLER_URL" to "http://hm-roller",
"HM_ROLLER_AUDIENCE" to "dev-gcp:teamdigihot:hm-roller",
"BIGQUERY_DATASET_ID" to "hm_soknadsbehandling_v1_dataset_dev",
)
),
)
private val prodProperties = ConfigurationMap(
mapOf(
Expand All @@ -53,7 +53,7 @@ private val prodProperties = ConfigurationMap(
"HM_ROLLER_URL" to "http://hm-roller",
"HM_ROLLER_AUDIENCE" to "prod-gcp:teamdigihot:hm-roller",
"BIGQUERY_DATASET_ID" to "hm_soknadsbehandling_v1_dataset_prod",
)
),
)

private fun config() = when (System.getenv("NAIS_CLUSTER_NAME") ?: System.getProperty("NAIS_CLUSTER_NAME")) {
Expand All @@ -75,7 +75,7 @@ internal object Configuration {
val port: String = config[Key("db.port", stringType)],
val name: String = config[Key("db.database", stringType)],
val user: String? = config.getOrNull(Key("db.username", stringType)),
val password: String? = config.getOrNull(Key("db.password", stringType))
val password: String? = config.getOrNull(Key("db.password", stringType)),
)

data class Application(
Expand Down Expand Up @@ -105,5 +105,7 @@ internal object Configuration {
}

enum class Profile {
LOCAL, DEV, PROD
LOCAL,
DEV,
PROD,
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ internal class Oppgaveinspektør(
}
},
startTime,
TimeUnit.DAYS.toMillis(1)
TimeUnit.DAYS.toMillis(1),
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ object HjelpemiddeldatabaseClient {
GraphQLKtorClient(
url = URI("${Configuration.application.grunndataApiURL}/graphql").toURL(),
httpClient = HttpClient(engineFactory = CIO),
serializer = GraphQLClientJacksonSerializer()
serializer = GraphQLClientJacksonSerializer(),
)

suspend fun hentProdukterMedHmsnrs(hmsnrs: Set<String>): List<HentproduktermedhmsnrsProdukt> {
Expand Down
18 changes: 9 additions & 9 deletions src/main/kotlin/no/nav/hjelpemidler/soknad/db/db/HotsakStore.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ internal interface HotsakStore {
fun lagreVedtaksresultat(
knadId: UUID,
vedtaksresultat: String,
vedtaksdato: LocalDate
vedtaksdato: LocalDate,
): Int

fun hentVedtaksresultatForSøknad(søknadId: UUID): VedtaksresultatHotsakData?
Expand All @@ -39,15 +39,15 @@ internal class HotsakStorePostgres(private val ds: DataSource) : HotsakStore {
hotsakTilknytningData.saksnr,
null,
null,
).asUpdate
).asUpdate,
)
}
}

override fun lagreVedtaksresultat(
knadId: UUID,
vedtaksresultat: String,
vedtaksdato: LocalDate
vedtaksdato: LocalDate,
): Int =
time("oppdater_vedtaksresultat_fra_hotsak") {
using(sessionOf(ds)) { session ->
Expand All @@ -57,7 +57,7 @@ internal class HotsakStorePostgres(private val ds: DataSource) : HotsakStore {
vedtaksresultat,
vedtaksdato,
søknadId,
).asUpdate
).asUpdate,
)
}
}
Expand All @@ -76,7 +76,7 @@ internal class HotsakStorePostgres(private val ds: DataSource) : HotsakStore {
vedtaksresultat = it.stringOrNull("VEDTAKSRESULTAT"),
vedtaksdato = it.localDateOrNull("VEDTAKSDATO"),
)
}.asSingle
}.asSingle,
)
}
}
Expand All @@ -87,10 +87,10 @@ internal class HotsakStorePostgres(private val ds: DataSource) : HotsakStore {
session.run(
queryOf(
"SELECT SOKNADS_ID FROM V1_HOTSAK_DATA WHERE SAKSNUMMER = ? ",
saksnummer
saksnummer,
).map {
UUID.fromString(it.string("SOKNADS_ID"))
}.asSingle
}.asSingle,
)
}
return søknadsId
Expand All @@ -104,7 +104,7 @@ internal class HotsakStorePostgres(private val ds: DataSource) : HotsakStore {
søknadId,
).map {
true
}.asSingle
}.asSingle,
)
} ?: false
}
Expand All @@ -117,7 +117,7 @@ internal class HotsakStorePostgres(private val ds: DataSource) : HotsakStore {
søknadId,
).map {
it.string("SAKSNUMMER")
}.asSingle
}.asSingle,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ internal class InfotrygdStorePostgres(private val ds: DataSource) : InfotrygdSto
vedtaksresultatData.saksnr,
null,
null,
).asUpdate
).asUpdate,
)
}
}
Expand All @@ -66,7 +66,7 @@ internal class InfotrygdStorePostgres(private val ds: DataSource) : InfotrygdSto
vedtaksdato,
soknadsType,
søknadId,
).asUpdate
).asUpdate,
)
}
}
Expand All @@ -75,7 +75,7 @@ internal class InfotrygdStorePostgres(private val ds: DataSource) : InfotrygdSto
override fun hentSøknadIdFraVedtaksresultat(
fnrBruker: String,
saksblokkOgSaksnr: String,
vedtaksdato: LocalDate
vedtaksdato: LocalDate,
): UUID? {
val uuids: List<UUID> = time("hent_søknadid_fra_resultat") {
using(sessionOf(ds)) { session ->
Expand All @@ -88,7 +88,7 @@ internal class InfotrygdStorePostgres(private val ds: DataSource) : InfotrygdSto
vedtaksdato,
).map {
UUID.fromString(it.string("SOKNADS_ID"))
}.asList
}.asList,
)
}
}
Expand Down Expand Up @@ -121,7 +121,7 @@ internal class InfotrygdStorePostgres(private val ds: DataSource) : InfotrygdSto
UUID.fromString(it.string("SOKNADS_ID")),
it.localDateOrNull("VEDTAKSDATO"),
)
}.asList
}.asList,
)
}
}
Expand Down Expand Up @@ -149,7 +149,7 @@ internal class InfotrygdStorePostgres(private val ds: DataSource) : InfotrygdSto
vedtaksresultat = it.stringOrNull("VEDTAKSRESULTAT"),
vedtaksdato = it.localDateOrNull("VEDTAKSDATO"),
)
}.asSingle
}.asSingle,
)
}
}
Expand All @@ -175,7 +175,7 @@ internal class InfotrygdStorePostgres(private val ds: DataSource) : InfotrygdSto
søknadId = UUID.fromString(it.string("SOKNADS_ID")),
fagsakId = it.string("TRYGDEKONTORNR") + it.string("SAKSBLOKK") + it.string("SAKSNR"),
)
}.asSingle
}.asSingle,
)
}
}
Expand All @@ -195,7 +195,7 @@ internal class InfotrygdStorePostgres(private val ds: DataSource) : InfotrygdSto
søknadId,
).map {
it.stringOrNull("SOKNADSTYPE")
}.asSingle
}.asSingle,
)
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/main/kotlin/no/nav/hjelpemidler/soknad/db/db/OrdreStore.kt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ internal class OrdreStorePostgres(private val ds: DataSource) : OrdreStore {
type = "jsonb"
value = ordrelinjeToJsonString(ordrelinje.data)
},
).asUpdate
).asUpdate,
)
}
}
Expand All @@ -72,10 +72,10 @@ internal class OrdreStorePostgres(private val ds: DataSource) : OrdreStore {
session.run(
queryOf(
query,
soknadsId
soknadsId,
).map {
it.string("HJELPEMIDDELTYPE")
}.asList
}.asList,
)
}
}
Expand All @@ -100,10 +100,10 @@ internal class OrdreStorePostgres(private val ds: DataSource) : OrdreStore {
session.run(
queryOf(
query,
soknadsId
soknadsId,
).map {
it.string("HJELPEMIDDELTYPE")
}.asList
}.asList,
)
}
}
Expand Down Expand Up @@ -134,7 +134,7 @@ internal class OrdreStorePostgres(private val ds: DataSource) : OrdreStore {
artikkelNr = it.string("ARTIKKELNR"),
datoUtsendelse = it.localDateOrNull("CREATED").toString(),
)
}.asList
}.asList,
)
}
}
Expand Down
Loading

0 comments on commit 30d4add

Please sign in to comment.