Skip to content

Commit 84ac5d4

Browse files
committed
La inn felt for antall ignorerte varsler
1 parent 71a0c70 commit 84ac5d4

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

apps/min-side-varsler/src/main/kotlin/no/nav/paw/arbeidssoekerregisteret/model/ResponseConverter.kt

+3-1
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,16 @@ private fun VarselEventName.asResponse(): HendelseName = when (this) {
6262
fun BestillingRow.asResponse(
6363
varslerTotalt: Long,
6464
varslerSendt: Long,
65-
varslerFeilet: Long
65+
varslerFeilet: Long,
66+
varslerIgnorert: Long
6667
): BestillingResponse = BestillingResponse(
6768
bestillingId = this.bestillingId,
6869
bestiller = this.bestiller,
6970
status = this.status.asResponse(),
7071
varslerTotalt = varslerTotalt,
7172
varslerSendt = varslerSendt,
7273
varslerFeilet = varslerFeilet,
74+
varslerIgnorert = varslerIgnorert,
7375
insertedTimestamp = this.insertedTimestamp,
7476
updatedTimestamp = this.updatedTimestamp
7577
)

apps/min-side-varsler/src/main/kotlin/no/nav/paw/arbeidssoekerregisteret/service/BestillingService.kt

+10-5
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,22 @@ class BestillingService(
4343
fun hentBestilling(bestillingId: UUID): BestillingResponse = transaction {
4444
val bestilling = bestillingRepository.findByBestillingId(bestillingId)
4545
?: throw BestillingIkkeFunnetException("Bestilling ikke funnet")
46-
val totalCount = bestiltVarselRepository.countByBestillingId(bestillingId)
47-
val sendtCount = bestiltVarselRepository.countByBestillingIdAndStatus(bestillingId, BestiltVarselStatus.SENDT)
48-
val feiletCount = bestiltVarselRepository.countByBestillingIdAndStatus(bestillingId, BestiltVarselStatus.FEILET)
49-
bestilling.asResponse(totalCount, sendtCount, feiletCount)
46+
val totalCount = bestiltVarselRepository
47+
.countByBestillingId(bestillingId)
48+
val sendtCount = bestiltVarselRepository
49+
.countByBestillingIdAndStatus(bestillingId, BestiltVarselStatus.SENDT)
50+
val feiletCount = bestiltVarselRepository
51+
.countByBestillingIdAndStatus(bestillingId, BestiltVarselStatus.FEILET)
52+
val ignorertCount = bestiltVarselRepository
53+
.countByBestillingIdAndStatus(bestillingId, BestiltVarselStatus.IGNORERT)
54+
bestilling.asResponse(totalCount, sendtCount, feiletCount, ignorertCount)
5055
}
5156

5257
@WithSpan("opprettBestilling")
5358
fun opprettBestilling(bestiller: String): BestillingResponse = transaction {
5459
val bestillingId = UUID.randomUUID()
5560
bestillingRepository.insert(InsertBestillingRow(bestillingId, bestiller))
56-
bestillingRepository.findByBestillingId(bestillingId)?.asResponse(0, 0, 0)
61+
bestillingRepository.findByBestillingId(bestillingId)?.asResponse(0, 0, 0, 0)
5762
?: throw BestillingIkkeFunnetException("Bestilling ikke funnet")
5863
}
5964

apps/min-side-varsler/src/main/resources/openapi/documentation.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,9 @@ components:
225225
varslerFeilet:
226226
type: integer
227227
format: int64
228+
varslerIgnorert:
229+
type: integer
230+
format: int64
228231
insertedTimestamp:
229232
type: "string"
230233
format: "date-time"
@@ -238,6 +241,7 @@ components:
238241
- "varslerTotalt"
239242
- "varslerSendt"
240243
- "varslerFeilet"
244+
- "varslerIgnorert"
241245
- "insertedTimestamp"
242246
example:
243247
bestillingId: "84201f96-363b-4aab-a589-89fa4b9b1feb"

0 commit comments

Comments
 (0)