Skip to content

Commit

Permalink
les arrangor-melding-v1 topic og lagre forslag
Browse files Browse the repository at this point in the history
For å kunne returnere relevante forslag
  • Loading branch information
fredrikpe committed Dec 9, 2024
1 parent 6d62ee6 commit 9c810d8
Show file tree
Hide file tree
Showing 16 changed files with 651 additions and 60 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
package no.nav.mulighetsrommet.domain.dto.amt

import kotlinx.serialization.Serializable
import no.nav.mulighetsrommet.domain.serializers.LocalDateSerializer
import no.nav.mulighetsrommet.domain.serializers.LocalDateTimeSerializer
import no.nav.mulighetsrommet.domain.serializers.UUIDSerializer
import java.time.LocalDate
import java.time.LocalDateTime
import java.util.*

@Serializable
sealed interface Melding {
val id: UUID
val deltakerId: UUID
val opprettetAvArrangorAnsattId: UUID
val opprettet: LocalDateTime
}

@Serializable
data class EndringFraArrangor(
@Serializable(with = UUIDSerializer::class)
override val id: UUID,
@Serializable(with = UUIDSerializer::class)
override val deltakerId: UUID,
@Serializable(with = UUIDSerializer::class)
override val opprettetAvArrangorAnsattId: UUID,
@Serializable(with = LocalDateTimeSerializer::class)
override val opprettet: LocalDateTime,
val endring: Endring,
) : Melding {
@Serializable
sealed interface Endring {
@Serializable
data class LeggTilOppstartsdato(
@Serializable(with = LocalDateSerializer::class)
val startdato: LocalDate,
@Serializable(with = LocalDateSerializer::class)
val sluttdato: LocalDate?,
) : Endring
}
}

@Serializable
data class Forslag(
@Serializable(with = UUIDSerializer::class)
override val id: UUID,
@Serializable(with = UUIDSerializer::class)
override val deltakerId: UUID,
@Serializable(with = UUIDSerializer::class)
override val opprettetAvArrangorAnsattId: UUID,
@Serializable(with = LocalDateTimeSerializer::class)
override val opprettet: LocalDateTime,
val begrunnelse: String?,
val endring: Endring,
val status: Status,
) : Melding {
@Serializable
sealed interface Status {
@Serializable
data class Godkjent(
val godkjentAv: NavAnsatt,
@Serializable(with = LocalDateTimeSerializer::class)
val godkjent: LocalDateTime,
) : Status

@Serializable
data class Avvist(
val avvistAv: NavAnsatt,
@Serializable(with = LocalDateTimeSerializer::class)
val avvist: LocalDateTime,
val begrunnelseFraNav: String,
) : Status

@Serializable
data class Tilbakekalt(
@Serializable(with = UUIDSerializer::class)
val tilbakekaltAvArrangorAnsattId: UUID,
@Serializable(with = LocalDateTimeSerializer::class)
val tilbakekalt: LocalDateTime,
) : Status

@Serializable
data class Erstattet(
@Serializable(with = UUIDSerializer::class)
val erstattetMedForslagId: UUID,
@Serializable(with = LocalDateTimeSerializer::class)
val erstattet: LocalDateTime,
) : Status

@Serializable
data object VenterPaSvar : Status
}

@Serializable
sealed interface Endring {
@Serializable
data class ForlengDeltakelse(
@Serializable(with = LocalDateSerializer::class)
val sluttdato: LocalDate,
) : Endring

@Serializable
data class AvsluttDeltakelse(
@Serializable(with = LocalDateSerializer::class)
val sluttdato: LocalDate?,
val aarsak: EndringAarsak,
val harDeltatt: Boolean?,
) : Endring

@Serializable
data class IkkeAktuell(
val aarsak: EndringAarsak,
) : Endring

@Serializable
data class Deltakelsesmengde(
val deltakelsesprosent: Int,
val dagerPerUke: Int?,
@Serializable(with = LocalDateSerializer::class)
val gyldigFra: LocalDate?,
) : Endring

@Serializable
data class Startdato(
@Serializable(with = LocalDateSerializer::class)
val startdato: LocalDate,
@Serializable(with = LocalDateSerializer::class)
val sluttdato: LocalDate?,
) : Endring

@Serializable
data class Sluttdato(
@Serializable(with = LocalDateSerializer::class)
val sluttdato: LocalDate,
) : Endring

@Serializable
data class Sluttarsak(
val aarsak: EndringAarsak,
) : Endring
}

@Serializable
data class NavAnsatt(
@Serializable(with = UUIDSerializer::class)
val id: UUID,
@Serializable(with = UUIDSerializer::class)
val enhetId: UUID,
)
}

@Serializable
sealed interface EndringAarsak {
@Serializable
data object Syk : EndringAarsak

@Serializable
data object FattJobb : EndringAarsak

@Serializable
data object TrengerAnnenStotte : EndringAarsak

@Serializable
data object Utdanning : EndringAarsak

@Serializable
data object IkkeMott : EndringAarsak

@Serializable
data class Annet(
val beskrivelse: String,
) : EndringAarsak
}
111 changes: 58 additions & 53 deletions frontend/arrangor-flate/app/mocks/arrangorflateMocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,51 @@ import {
ArrangorflateTilsagn,
RefusjonKravAft,
RefusjonskravStatus,
RelevanteForslag,
} from "@mr/api-client";
import { http, HttpResponse, PathParams } from "msw";
import { v4 as uuid } from "uuid";

const mockDeltakelser = [
{
id: uuid(),
person: {
navn: "Per Petterson",
fodselsdato: "1980-01-01",
fodselsaar: 1980,
},
startDato: "2024-06-01",
forstePeriodeStartDato: "2024-06-01",
sistePeriodeSluttDato: "2024-06-30",
sistePeriodeDeltakelsesprosent: 30,
manedsverk: 0.3,
},
{
id: uuid(),
person: {
navn: "Stian Bjærvik",
fodselsaar: 1980,
},
startDato: "2024-06-01",
forstePeriodeStartDato: "2024-06-01",
sistePeriodeSluttDato: "2024-06-30",
sistePeriodeDeltakelsesprosent: 100,
manedsverk: 1,
},
{
id: uuid(),
person: {
navn: "Donald Duck",
fodselsaar: 1980,
},
startDato: "2024-06-01",
forstePeriodeStartDato: "2024-06-01",
sistePeriodeSluttDato: "2024-06-30",
sistePeriodeDeltakelsesprosent: 100,
manedsverk: 1,
},
];

const mockKrav: RefusjonKravAft[] = [
{
type: "AFT",
Expand All @@ -30,33 +71,7 @@ const mockKrav: RefusjonKravAft[] = [
navn: "Fretex",
slettet: false,
},
deltakelser: [
{
id: uuid(),
person: {
navn: "Per Petterson",
fodselsdato: "1980-01-01",
fodselsaar: 1980,
},
startDato: "2024-06-01",
forstePeriodeStartDato: "2024-06-01",
sistePeriodeSluttDato: "2024-06-30",
sistePeriodeDeltakelsesprosent: 30,
manedsverk: 0.3,
},
{
id: uuid(),
person: {
navn: "Stian Bjærvik",
fodselsaar: 1980,
},
startDato: "2024-06-01",
forstePeriodeStartDato: "2024-06-01",
sistePeriodeSluttDato: "2024-06-30",
sistePeriodeDeltakelsesprosent: 100,
manedsverk: 1,
},
],
deltakelser: mockDeltakelser,
beregning: {
periodeStart: "2024-06-01",
periodeSlutt: "2024-06-30",
Expand Down Expand Up @@ -87,32 +102,7 @@ const mockKrav: RefusjonKravAft[] = [
navn: "Fretex",
slettet: false,
},
deltakelser: [
{
id: uuid(),
person: {
navn: "Per Petterson",
fodselsdato: "1980-01-01",
fodselsaar: 1980,
},
startDato: "2024-06-01",
forstePeriodeStartDato: "2024-06-01",
sistePeriodeSluttDato: "2024-06-30",
sistePeriodeDeltakelsesprosent: 30,
manedsverk: 0.3,
},
{
id: uuid(),
person: {
navn: "Stian Bjærvik",
},
startDato: "2024-06-01",
forstePeriodeStartDato: "2024-06-01",
sistePeriodeSluttDato: "2024-06-30",
sistePeriodeDeltakelsesprosent: 100,
manedsverk: 1,
},
],
deltakelser: mockDeltakelser,
beregning: {
periodeStart: "2024-06-01",
periodeSlutt: "2024-06-30",
Expand Down Expand Up @@ -263,6 +253,17 @@ const arrangorer: Arrangor[] = [
},
];

const mockRelevanteForslag: RelevanteForslag[] = [
{
deltakerId: mockDeltakelser[0].id,
antallRelevanteForslag: 1,
},
{
deltakerId: mockDeltakelser[1].id,
antallRelevanteForslag: 0,
},
];

export const arrangorflateHandlers = [
http.get<PathParams, RefusjonKravAft[]>(
"*/api/v1/intern/arrangorflate/arrangor/:orgnr/refusjonskrav",
Expand All @@ -287,6 +288,10 @@ export const arrangorflateHandlers = [
"*/api/v1/intern/arrangorflate/refusjonskrav/:id/tilsagn",
() => HttpResponse.json(mockTilsagn),
),
http.get<PathParams, RefusjonKravAft[]>(
"*/api/v1/intern/arrangorflate/refusjonskrav/:id/relevante-forslag",
() => HttpResponse.json(mockRelevanteForslag),
),
http.get<PathParams, RefusjonKravAft[]>(
"*/api/v1/intern/arrangorflate/arrangor/:orgnr/tilsagn",
() => HttpResponse.json(mockTilsagn),
Expand Down
Loading

0 comments on commit 9c810d8

Please sign in to comment.