Skip to content

Commit

Permalink
Gjør om yearmonth til date (#6831)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bjodn authored Jan 22, 2025
1 parent ecf8775 commit 285d43d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ import io.ktor.server.routing.post
import io.ktor.server.routing.route
import no.nav.etterlatte.AuthorizationPlugin
import no.nav.etterlatte.libs.common.person.Folkeregisteridentifikator
import no.nav.etterlatte.libs.common.vedtak.Periode
import no.nav.etterlatte.libs.ktor.route.FoedselsnummerDTO
import no.nav.etterlatte.libs.ktor.token.Issuer
import java.math.BigDecimal
import java.time.YearMonth
import java.time.LocalDate

fun Route.vedtakRoute(vedtakService: VedtakService) {
// Tiltenkt for eksternt for etterlatte men internt i Nav. Initelt gjelder dette EESSI.
Expand Down Expand Up @@ -45,7 +44,7 @@ data class VedtakTilPerson(
data class Vedtak(
val sakId: Long,
val sakType: String,
val virkningstidspunkt: YearMonth,
val virkningstidspunkt: LocalDate,
val type: VedtakType,
val utbetaling: List<VedtakUtbetaling>,
)
Expand All @@ -58,6 +57,7 @@ enum class VedtakType {
}

data class VedtakUtbetaling(
val periode: Periode,
val fraOgMed: LocalDate,
val tilOgMed: LocalDate,
val beloep: BigDecimal?,
)
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package no.nav.etterlatte.vedtak
import no.nav.etterlatte.libs.common.person.Folkeregisteridentifikator
import no.nav.etterlatte.libs.common.vedtak.VedtakDto
import no.nav.etterlatte.libs.common.vedtak.VedtakInnholdDto
import no.nav.etterlatte.samordning.vedtak.atStartOfMonth

class VedtakService(
private val vedtaksvurderingKlient: VedtaksvurderingKlient,
Expand All @@ -20,12 +21,13 @@ fun VedtakDto.fromDto(): Vedtak {
return Vedtak(
sakId = sak.id.sakId,
sakType = sak.sakType.name,
virkningstidspunkt = vedtakInnhold.virkningstidspunkt,
virkningstidspunkt = vedtakInnhold.virkningstidspunkt.atStartOfMonth(),
type = VedtakType.valueOf(type.name),
utbetaling =
vedtakInnhold.utbetalingsperioder.map { utbetaling ->
VedtakUtbetaling(
periode = utbetaling.periode,
fraOgMed = utbetaling.periode.fom.atStartOfMonth(),
tilOgMed = utbetaling.periode.fom.atEndOfMonth(),
beloep = utbetaling.beloep,
)
},
Expand Down
27 changes: 13 additions & 14 deletions apps/etterlatte-api/src/main/resources/vedtakSwaggerV1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ components:
type: string
virkningstidspunkt:
type: string
format: year-month
example: "2025-01"
format: date
example: "2025-01-01"
description: "Vil alltid være 1. i måned"
type:
$ref: '#/components/schemas/VedtakType'
utbetaling:
Expand All @@ -77,19 +78,17 @@ components:
VedtakUtbetaling:
type: object
properties:
periode:
$ref: '#/components/schemas/Periode'
beloep:
type: string
format: decimal
description: BigDecimal

Periode:
type: object
properties:
start:
fraOgMed:
type: string
format: date
end:
example: "2025-01-01"
description: "Vil alltid være 1. i måned"
tilOgMed:
type: string
format: date
example: "2025-01-31"
description: "Vil alltid være siste dag i måned"
beloep:
type: string
format: decimal
description: BigDecimal

0 comments on commit 285d43d

Please sign in to comment.