@@ -43,17 +43,22 @@ class BestillingService(
43
43
fun hentBestilling (bestillingId : UUID ): BestillingResponse = transaction {
44
44
val bestilling = bestillingRepository.findByBestillingId(bestillingId)
45
45
? : 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)
50
55
}
51
56
52
57
@WithSpan(" opprettBestilling" )
53
58
fun opprettBestilling (bestiller : String ): BestillingResponse = transaction {
54
59
val bestillingId = UUID .randomUUID()
55
60
bestillingRepository.insert(InsertBestillingRow (bestillingId, bestiller))
56
- bestillingRepository.findByBestillingId(bestillingId)?.asResponse(0 , 0 , 0 )
61
+ bestillingRepository.findByBestillingId(bestillingId)?.asResponse(0 , 0 , 0 , 0 )
57
62
? : throw BestillingIkkeFunnetException (" Bestilling ikke funnet" )
58
63
}
59
64
0 commit comments