Skip to content

Commit d6f4092

Browse files
committed
Fjernet forhåndsgodkjenning fra CSV
1 parent dc95eb8 commit d6f4092

File tree

12 files changed

+38
-29
lines changed

12 files changed

+38
-29
lines changed

.github/workflows/arbeidssoekere-synk-jobb.yaml

-7
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,7 @@ on:
77
- dev/*
88
paths:
99
- 'jobs/arbeidssoekere-synk-jobb/**'
10-
- 'lib/**'
11-
- 'domain/**'
1210
- 'arbeidssoekere-synk-jobb.yaml'
13-
- 'gradle/**'
14-
- 'settings.gradle.kts'
15-
- 'gradle.properties'
16-
- 'gradlew'
17-
- 'gradlew.bat'
1811

1912
env:
2013
MODULE: arbeidssoekere-synk-jobb

jobs/arbeidssoekere-synk-jobb/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ konfig-filen.
1313
Informasjon om secrets fra [NAIS docs](https://docs.nais.io/services/secrets/).
1414

1515
```shell
16-
kubectl create secret generic paw-arbeidssoekere-synk-jobb-csv --from-file=v1.csv=/tmp/paw-arbeidssoekere-synk-jobb-csv-v1.csv
16+
kubectl create secret generic paw-arbeidssoekere-synk-jobb-csv --from-file=v1.csv=/tmp/paw-arbeidssoekere-synk-jobb-csv/v1.csv
1717
```
1818

1919
For å endre secret må den slettes og skapes på nytt.

jobs/arbeidssoekere-synk-jobb/src/main/kotlin/no/nav/paw/arbeidssoeker/synk/Job.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fun main() {
3636
val inngangHttpConsumer = InngangHttpConsumer(jobConfig.apiInngangBaseUrl) {
3737
azureAdM2MTokenClient.createMachineToMachineToken(jobConfig.apiInngangScope)
3838
}
39-
val arbeidssoekerSynkService = ArbeidssoekerSynkService(arbeidssoekerSynkRepository, inngangHttpConsumer)
39+
val arbeidssoekerSynkService = ArbeidssoekerSynkService(jobConfig, arbeidssoekerSynkRepository, inngangHttpConsumer)
4040

4141
try {
4242
logger.info("Starter $name")

jobs/arbeidssoekere-synk-jobb/src/main/kotlin/no/nav/paw/arbeidssoeker/synk/config/JobConfig.kt

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const val JOB_CONFIG = "job_config.toml"
77

88
data class JobConfig(
99
val syncFilePath: String,
10+
val markerForhaandsgodkjentAvAnsatt: Boolean,
1011
val apiInngangBaseUrl: String,
1112
val apiInngangScope: String,
1213
val runtimeEnvironment: RuntimeEnvironment = currentRuntimeEnvironment

jobs/arbeidssoekere-synk-jobb/src/main/kotlin/no/nav/paw/arbeidssoeker/synk/model/Arbeidssoeker.kt

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ import java.time.Instant
44

55
data class Arbeidssoeker(
66
val identitetsnummer: String,
7-
val originalStartTidspunkt: Instant,
8-
val forhaandsgodkjentAvAnsatt: Boolean = false,
7+
val originalStartTidspunkt: Instant
98
)
109

1110
data class VersjonertArbeidssoeker(

jobs/arbeidssoekere-synk-jobb/src/main/kotlin/no/nav/paw/arbeidssoeker/synk/model/Converters.kt

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ import org.jetbrains.exposed.sql.ResultRow
66
import java.time.Duration
77
import java.time.Instant
88

9-
fun Arbeidssoeker.asVersioned(version: String): VersjonertArbeidssoeker = VersjonertArbeidssoeker(
9+
fun Arbeidssoeker.asVersioned(
10+
version: String,
11+
forhaandsgodkjentAvAnsatt: Boolean = false
12+
): VersjonertArbeidssoeker = VersjonertArbeidssoeker(
1013
version = version,
1114
identitetsnummer = identitetsnummer,
1215
originalStartTidspunkt = originalStartTidspunkt,

jobs/arbeidssoekere-synk-jobb/src/main/kotlin/no/nav/paw/arbeidssoeker/synk/service/ArbeidssoekerSynkService.kt

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package no.nav.paw.arbeidssoeker.synk.service
22

33
import io.opentelemetry.instrumentation.annotations.WithSpan
4+
import no.nav.paw.arbeidssoeker.synk.config.JobConfig
45
import no.nav.paw.arbeidssoeker.synk.consumer.InngangHttpConsumer
56
import no.nav.paw.arbeidssoeker.synk.model.VersjonertArbeidssoeker
67
import no.nav.paw.arbeidssoeker.synk.model.asOpprettPeriodeRequest
@@ -17,6 +18,7 @@ import java.time.Instant
1718
import kotlin.io.path.name
1819

1920
class ArbeidssoekerSynkService(
21+
private val jobConfig: JobConfig,
2022
private val arbeidssoekerSynkRepository: ArbeidssoekerSynkRepository,
2123
private val inngangHttpConsumer: InngangHttpConsumer
2224
) {
@@ -36,7 +38,8 @@ class ArbeidssoekerSynkService(
3638
logger.info("Prosessert {} linjer CSV-data på {} ms", totalCount, timestamp.millisSince())
3739
}
3840
val arbeidssoeker = values.nextValue()
39-
prosesserArbeidssoeker(arbeidssoeker.asVersioned(path.name))
41+
.asVersioned(path.name, jobConfig.markerForhaandsgodkjentAvAnsatt)
42+
prosesserArbeidssoeker(arbeidssoeker)
4043
}
4144
logger.info("Fullførte prosessering av {} linjer CSV-data på {} ms", totalCount, timestamp.millisSince())
4245
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
syncFilePath = "/tmp/v1.csv"
2+
markerForhaandsgodkjentAvAnsatt = false
23
apiInngangBaseUrl = "http://localhost:8090"
3-
apiInngangScope = "api://localhost.paw.paw-arbeidssokerregisteret-api-inngang/.default"
4+
apiInngangScope = "api://test.paw.paw-arbeidssokerregisteret-api-inngang/.default"

jobs/arbeidssoekere-synk-jobb/src/main/resources/logback.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,18 @@
3636
<root level="INFO">
3737
<appender-ref ref="STDOUT_JSON"/>
3838
</root>
39-
<logger name="no.nav" level="DEBUG"/>
4039
<logger name="no.nav.paw.logger.secure" level="INFO" additivity="false">
4140
<appender-ref ref="SECURE_LOG_JSON"/>
4241
</logger>
42+
<logger name="no.nav.paw" level="DEBUG"/>
4343
</then>
4444
</if>
4545
<if condition='"${NAIS_CLUSTER_NAME}" == "NAIS_CLUSTER_NAME_IS_UNDEFINED"'>
4646
<then>
4747
<root level="INFO">
4848
<appender-ref ref="STDOUT"/>
4949
</root>
50-
<logger name="no.nav" level="DEBUG"/>
50+
<logger name="no.nav.paw" level="DEBUG"/>
5151
</then>
5252
</if>
5353
</configuration>
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
syncFilePath = "/var/run/secrets/paw-arbeidssoekere-synk-jobb-csv/v1.csv"
2-
apiInngangBaseUrl = "http://paw-arbeidssokerregisteret-api-inngang:8080"
2+
markerForhaandsgodkjentAvAnsatt = false
3+
apiInngangBaseUrl = "http://paw-arbeidssokerregisteret-api-inngang"
34
apiInngangScope = "api://${NAIS_CLUSTER_NAME}.paw.paw-arbeidssokerregisteret-api-inngang/.default"
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,27 @@
11
package no.nav.paw.arbeidssoeker.synk.test
22

33
import io.ktor.http.*
4+
import no.nav.paw.arbeidssoeker.synk.config.JOB_CONFIG
5+
import no.nav.paw.arbeidssoeker.synk.config.JobConfig
46
import no.nav.paw.arbeidssoeker.synk.consumer.InngangHttpConsumer
57
import no.nav.paw.arbeidssoeker.synk.repository.ArbeidssoekerSynkRepository
68
import no.nav.paw.arbeidssoeker.synk.service.ArbeidssoekerSynkService
9+
import no.nav.paw.config.hoplite.loadNaisOrLocalConfiguration
710
import java.nio.file.Path
811

912
class MockArbeidssoekerSynkService(
1013
private val arbeidssoekerSynkRepository: ArbeidssoekerSynkRepository,
14+
private val jobConfig: JobConfig = loadNaisOrLocalConfiguration<JobConfig>(JOB_CONFIG),
1115
var responseMapping: Map<String, Pair<HttpStatusCode, String>> = emptyMap(),
1216
) {
1317
fun synkArbeidssoekere(path: Path) {
1418
val mockHttpClient = buildMockHttpClient(responseMapping)
1519
val inngangHttpConsumer = InngangHttpConsumer("http://whatever", mockHttpClient) { "dummy token" }
16-
val arbeidssoekerSynkService = ArbeidssoekerSynkService(arbeidssoekerSynkRepository, inngangHttpConsumer)
20+
val arbeidssoekerSynkService = ArbeidssoekerSynkService(
21+
jobConfig = jobConfig,
22+
arbeidssoekerSynkRepository = arbeidssoekerSynkRepository,
23+
inngangHttpConsumer = inngangHttpConsumer
24+
)
1725
arbeidssoekerSynkService.synkArbeidssoekere(path)
1826
}
1927
}
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
identitetsnummer,originalStartTidspunkt,forhaandsgodkjentAvAnsatt
2-
01017012345,1970-01-01T12:00:00.000Z,false
3-
02017012345,1970-01-02T12:00:00.000Z,false
4-
03017012345,1970-01-03T12:00:00.000Z,false
5-
04017012345,1970-01-04T12:00:00.000Z,false
6-
05017012345,1970-01-05T12:00:00.000Z,false
7-
06017012345,1970-01-06T12:00:00.000Z,false
8-
07017012345,1970-01-07T12:00:00.000Z,false
9-
08017012345,1970-01-08T12:00:00.000Z,false
10-
09017012345,1970-01-09T12:00:00.000Z,true
11-
10017012345,1970-01-10T12:00:00.000Z,true
1+
identitetsnummer,originalStartTidspunkt
2+
01017012345,1970-01-01T12:00:00.000Z
3+
02017012345,1970-01-02T12:00:00.000Z
4+
03017012345,1970-01-03T12:00:00.000Z
5+
04017012345,1970-01-04T12:00:00.000Z
6+
05017012345,1970-01-05T12:00:00.000Z
7+
06017012345,1970-01-06T12:00:00.000Z
8+
07017012345,1970-01-07T12:00:00.000Z
9+
08017012345,1970-01-08T12:00:00.000Z
10+
09017012345,1970-01-09T12:00:00.000Z
11+
10017012345,1970-01-10T12:00:00.000Z

0 commit comments

Comments
 (0)