@@ -62,7 +62,7 @@ fun Route.uklassifisertInntekt(
62
62
route(" /uklassifisert/{aktørId}/{kontekstType}/{kontekstId}/{beregningsDato}" ) {
63
63
get {
64
64
withContext(Dispatchers .IO ) {
65
- withInntektRequest {
65
+ withInntektRequest( " GET /uklassifisert/ " ) {
66
66
inntektStore.getInntektId(
67
67
Inntektparametre (
68
68
aktørId = this .aktørId,
@@ -83,7 +83,7 @@ fun Route.uklassifisertInntekt(
83
83
}
84
84
post {
85
85
withContext(Dispatchers .IO ) {
86
- withInntektRequest {
86
+ withInntektRequest( " POST /uklassifisert/ " ) {
87
87
val guiInntekt = call.receive<GUIInntekt >()
88
88
mapToStoredInntekt(guiInntekt).let {
89
89
inntektStore.storeInntekt(
@@ -121,37 +121,29 @@ fun Route.uklassifisertInntekt(
121
121
get {
122
122
val callId = call.callId
123
123
withContext(Dispatchers .IO ) {
124
- withInntektRequest {
125
- withLoggingContext(
126
- " route" to " /uklassifisert/uncached" ,
127
- " aktørId" to aktørId,
128
- " kontekstType" to kontekstType,
129
- " kontekstId" to kontekstId,
130
- " beregningsDato" to beregningsDato.toString()
131
- ) {
132
- val opptjeningsperiode = Opptjeningsperiode (this .beregningsDato)
133
- toInntektskomponentRequest(this , opptjeningsperiode).let {
134
- logger.info { " Henter nye inntekter fra inntektskomponenten" }
135
- inntektskomponentClient.getInntekt(it, callId = callId)
136
- }.let {
137
- logger.info { " Fikk nye inntekter fra inntektskomponenten" }
138
- val person = personOppslag.hentPerson(this .aktørId)
139
- val inntektsmottaker =
140
- Inntektsmottaker (person?.fødselsnummer, person?.sammensattNavn())
141
- mapToGUIInntekt(it, opptjeningsperiode, inntektsmottaker)
142
- }.let {
143
- call.respond(HttpStatusCode .OK , it)
144
- }.also {
145
- inntektOppfriskingCounter.inc()
146
- }
124
+ withInntektRequest(" GET /uklassifisert/uncached/" ) {
125
+ val opptjeningsperiode = Opptjeningsperiode (this .beregningsDato)
126
+ toInntektskomponentRequest(this , opptjeningsperiode).let {
127
+ logger.info { " Henter nye inntekter fra inntektskomponenten" }
128
+ inntektskomponentClient.getInntekt(it, callId = callId)
129
+ }.let {
130
+ logger.info { " Fikk nye inntekter fra inntektskomponenten" }
131
+ val person = personOppslag.hentPerson(this .aktørId)
132
+ val inntektsmottaker =
133
+ Inntektsmottaker (person?.fødselsnummer, person?.sammensattNavn())
134
+ mapToGUIInntekt(it, opptjeningsperiode, inntektsmottaker)
135
+ }.let {
136
+ call.respond(HttpStatusCode .OK , it)
137
+ }.also {
138
+ inntektOppfriskingCounter.inc()
147
139
}
148
140
}
149
141
}
150
142
}
151
143
152
144
post {
153
145
withContext(Dispatchers .IO ) {
154
- withInntektRequest {
146
+ withInntektRequest( " POST /uklassifisert/uncached/ " ) {
155
147
val guiInntekt = call.receive<GUIInntekt >()
156
148
mapToDetachedInntekt(guiInntekt).let {
157
149
inntektStore.storeInntekt(
@@ -209,7 +201,10 @@ private fun PipelineContext<Unit, ApplicationCall>.getSubject(): String {
209
201
}
210
202
}
211
203
212
- private inline fun PipelineContext <Unit , ApplicationCall >.withInntektRequest (block : InntektRequest .() -> Unit ) {
204
+ private inline fun PipelineContext <Unit , ApplicationCall >.withInntektRequest (
205
+ route : String ,
206
+ block : InntektRequest .() -> Unit
207
+ ) {
213
208
val inntektRequest = runCatching {
214
209
InntektRequest (
215
210
aktørId = call.parameters[" aktørId" ]!! ,
@@ -220,6 +215,7 @@ private inline fun PipelineContext<Unit, ApplicationCall>.withInntektRequest(blo
220
215
}.getOrElse { t -> throw IllegalArgumentException (" Failed to parse parameters" , t) }
221
216
222
217
withLoggingContext(
218
+ " route" to route,
223
219
" kontekstId" to inntektRequest.kontekstId,
224
220
" kontekstType" to inntektRequest.kontekstType
225
221
) {
0 commit comments