From 02178d187f99170e1649492adc585aa36c7c1f53 Mon Sep 17 00:00:00 2001 From: Sindre Kjelsrud Date: Tue, 1 Aug 2023 11:48:28 +0200 Subject: [PATCH 01/11] =?UTF-8?q?=F0=9F=92=84=20La=20til=20knapper=20for?= =?UTF-8?q?=20redigering=20og=20lukk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Markus A. R. Johansen --- frontend/src/components/FeilCard.tsx | 23 +++++++++++++++++++++-- frontend/src/components/FeilModal.tsx | 1 + 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/FeilCard.tsx b/frontend/src/components/FeilCard.tsx index d71eded..7c4d68b 100644 --- a/frontend/src/components/FeilCard.tsx +++ b/frontend/src/components/FeilCard.tsx @@ -1,8 +1,9 @@ import "@navikt/ds-css"; -import { Heading, Modal, Tag } from "@navikt/ds-react"; +import { Button, Heading, Modal, Tag } from "@navikt/ds-react"; import { IFeilmelding } from "../interface"; import FeilModal from "./FeilModal"; import { useEffect, useState } from "react"; +import { PencilIcon, XMarkIcon } from "@navikt/aksel-icons"; /** * En konteiner som inneholder all informasjon og funksjonalitet for å vise og interagere med en feilmelding. @@ -34,7 +35,25 @@ export const FeilKort = (props: IFeilKort) => { - +
+ +
+ + +
+
+ +
{/* TODO: HER KOMMER CONTENT */}
diff --git a/frontend/src/components/FeilModal.tsx b/frontend/src/components/FeilModal.tsx index 9901257..483684c 100644 --- a/frontend/src/components/FeilModal.tsx +++ b/frontend/src/components/FeilModal.tsx @@ -16,6 +16,7 @@ const FeilModal = (props: modalInterface) => { aria-label={" modal"} onClose={() => props.setOpen(false)} aria-labelledby="modal-heading" + closeButton={false} > {props.children} From 3792ee686107c49eb105b719257f43bcc764c983 Mon Sep 17 00:00:00 2001 From: Sindre Kjelsrud Date: Tue, 1 Aug 2023 12:08:45 +0200 Subject: [PATCH 02/11] =?UTF-8?q?=E2=9C=A8=20Klarer=20=C3=A5=20skifte=20me?= =?UTF-8?q?llom=20redigerings-=20og=20visningsmodus?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Markus A. R. Johansen --- frontend/src/components/FeilCard.tsx | 72 +++++++++++++++++++++------- 1 file changed, 55 insertions(+), 17 deletions(-) diff --git a/frontend/src/components/FeilCard.tsx b/frontend/src/components/FeilCard.tsx index 7c4d68b..16923ca 100644 --- a/frontend/src/components/FeilCard.tsx +++ b/frontend/src/components/FeilCard.tsx @@ -3,7 +3,7 @@ import { Button, Heading, Modal, Tag } from "@navikt/ds-react"; import { IFeilmelding } from "../interface"; import FeilModal from "./FeilModal"; import { useEffect, useState } from "react"; -import { PencilIcon, XMarkIcon } from "@navikt/aksel-icons"; +import { FloppydiskIcon, PencilIcon, XMarkIcon } from "@navikt/aksel-icons"; /** * En konteiner som inneholder all informasjon og funksjonalitet for å vise og interagere med en feilmelding. @@ -15,12 +15,20 @@ import { PencilIcon, XMarkIcon } from "@navikt/aksel-icons"; interface IFeilKort extends IFeilmelding { key: number } + + export const FeilKort = (props: IFeilKort) => { const [visModal, setVisModal] = useState(false) + const [redigeringsmodus, setRedigeringsmodus] = useState(false) useEffect(() => { Modal.setAppElement(document.getElementById('root')); }, []); + + const lagreEndringer = () => { + setRedigeringsmodus(false) + + } return( <> @@ -35,23 +43,53 @@ export const FeilKort = (props: IFeilKort) => { -
- -
- - + {redigeringsmodus ? + +
+ +
+ + +
-
+ + : +
+ +
+ + +
+
+ }
From bb4a1c1943aaf196b208a33472ebedb8fb56f1cf Mon Sep 17 00:00:00 2001 From: Sindre Kjelsrud Date: Tue, 1 Aug 2023 12:38:06 +0200 Subject: [PATCH 03/11] =?UTF-8?q?=F0=9F=9A=A7=20Jobber=20med=20endring=20a?= =?UTF-8?q?v=20tittel,=20beskrivelse=20og=20arbeidsstatus?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit WIP: må pulle main først for å få tak i nytt interface Co-authored-by: Markus A. R. Johansen --- frontend/src/components/FeilCard.tsx | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/FeilCard.tsx b/frontend/src/components/FeilCard.tsx index 16923ca..990c6ca 100644 --- a/frontend/src/components/FeilCard.tsx +++ b/frontend/src/components/FeilCard.tsx @@ -1,5 +1,5 @@ import "@navikt/ds-css"; -import { Button, Heading, Modal, Tag } from "@navikt/ds-react"; +import { Button, Heading, Modal, Radio, RadioGroup, Tag, TextField } from "@navikt/ds-react"; import { IFeilmelding } from "../interface"; import FeilModal from "./FeilModal"; import { useEffect, useState } from "react"; @@ -25,9 +25,10 @@ export const FeilKort = (props: IFeilKort) => { Modal.setAppElement(document.getElementById('root')); }, []); + const [arbeidsstatus, setArbeidsstatus] = useState(0) + const lagreEndringer = () => { setRedigeringsmodus(false) - } return( @@ -46,7 +47,26 @@ export const FeilKort = (props: IFeilKort) => { {redigeringsmodus ?
- +
+ + + {setArbeidsstatus(arbeidsstatus)}} + value={arbeidsstatus} + > + Ikke påbegynt + Feilen jobbes med + Feilen er fikset + +
{redigeringsmodus ? @@ -89,7 +95,13 @@ export const FeilKort = (props: IFeilKort) => { :
- +
- +
) } diff --git a/frontend/src/interface.ts b/frontend/src/interface.ts index 4edcb50..4757bd0 100644 --- a/frontend/src/interface.ts +++ b/frontend/src/interface.ts @@ -6,14 +6,17 @@ export interface IFeilmelding { tittel: string, beskrivelse: string - // haster: boolean dato: Date + haster: boolean + arbeidsstatus: number } export class Feilmelding implements IFeilmelding { tittel: string = "default tittel" beskrivelse: string = "default beskrivelse" dato: Date = new Date() + haster: boolean = false + arbeidsstatus: number = 0 /** * Typescript 2.1 syntax som lar deg sende inn et JSON object og mappe det til class. @@ -24,6 +27,8 @@ export class Feilmelding implements IFeilmelding { tittel: string, beskrivelse: string, dato: Date + haster: boolean + arbeidsstatus: number }) { if (fields) Object.assign(this, fields); } From 45f2815a7c628cb04efe0ad95e275d8eae1a6b3e Mon Sep 17 00:00:00 2001 From: Markus Johansen Date: Tue, 1 Aug 2023 10:28:09 +0200 Subject: [PATCH 05/11] =?UTF-8?q?=F0=9F=90=9B=20Manglet=20nye=20props=20i?= =?UTF-8?q?=20cardcontainer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/CardsContainer.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frontend/src/components/CardsContainer.tsx b/frontend/src/components/CardsContainer.tsx index e2a9dbd..1e93578 100644 --- a/frontend/src/components/CardsContainer.tsx +++ b/frontend/src/components/CardsContainer.tsx @@ -10,15 +10,19 @@ interface ICardsContainer { * @returns grid med feilmeldinger */ const CardsContainer = (props: ICardsContainer) => { + {props.feilmeldinger.map((feilMelding) => console.log(feilMelding))} return (
+ {props.feilmeldinger.map((feilMelding) => ( )) } From 7b0d3c3168be8ba8cc743571ccac486e088dbf7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amalie=20Mans=C3=A5ker?= Date: Tue, 1 Aug 2023 10:32:15 +0200 Subject: [PATCH 06/11] =?UTF-8?q?=F0=9F=90=9B=20S=C3=B8rger=20for=20at=20f?= =?UTF-8?q?eilmelding=20som=20blir=20sendt=20fra=20frontend=20matcher=20fe?= =?UTF-8?q?ilmeldingsobjekt=20i=20backend?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Sindre Kjelsrud --- frontend/src/pages/feil.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frontend/src/pages/feil.tsx b/frontend/src/pages/feil.tsx index ee889c1..ac0de6d 100644 --- a/frontend/src/pages/feil.tsx +++ b/frontend/src/pages/feil.tsx @@ -18,7 +18,9 @@ export default function Feil() { const payload = { tittel: tittel, beskrivelse: beskrivelse, - dato: new Date().toISOString().replace('Z', '') + dato: new Date().toISOString().replace('Z', ''), // Litt wack fix, burde endres + arbeidsstatus: 0, + haster: false } axios.post("/api/nyfeil", payload, { From c84e7890eba6f28f8538e25f25451bc059d82701 Mon Sep 17 00:00:00 2001 From: "Markus A. R. Johansen" <90006516+J0hans1@users.noreply.github.com> Date: Tue, 1 Aug 2023 10:42:20 +0200 Subject: [PATCH 07/11] =?UTF-8?q?=E2=9C=A8=20Statusflagg=20(#19)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ✨ Tagbar støtter toggling av arbeidsstatusflagg, ved å ta inn et arbeidsstatus prop som er 0,1 eller 2 * 🗃️ Legger til PK, arbeidsstatus og haster i database Co-authored-by: Amalie Erdal Mansåker * ✏️ Fikser glemt semikolon + glemte felt i tester Co-authored-by: Amalie Erdal Mansåker * 🍱 Oppdaterer interface frontend for å matche nye felt haster og arbeidsstatus * 🐛 Manglet nye props i cardcontainer * ✨ Tagbar støtter toggling av arbeidsstatusflagg, ved å ta inn et arbeidsstatus prop som er 0,1 eller 2 --------- Co-authored-by: Sindre Kjelsrud Co-authored-by: Amalie Erdal Mansåker Co-authored-by: Sid <93219711+SindreKjelsrud@users.noreply.github.com> --- frontend/src/components/CardsContainer.tsx | 4 +-- frontend/src/components/FeilCard.tsx | 34 ++++++++++++++++++---- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/frontend/src/components/CardsContainer.tsx b/frontend/src/components/CardsContainer.tsx index 1e93578..d51318d 100644 --- a/frontend/src/components/CardsContainer.tsx +++ b/frontend/src/components/CardsContainer.tsx @@ -9,9 +9,7 @@ interface ICardsContainer { * Komponent som laster inn feilmeldinger i kort fra database. * @returns grid med feilmeldinger */ -const CardsContainer = (props: ICardsContainer) => { - {props.feilmeldinger.map((feilMelding) => console.log(feilMelding))} - +const CardsContainer = (props: ICardsContainer) => { return (
diff --git a/frontend/src/components/FeilCard.tsx b/frontend/src/components/FeilCard.tsx index 2b04b66..6d0a8c4 100644 --- a/frontend/src/components/FeilCard.tsx +++ b/frontend/src/components/FeilCard.tsx @@ -148,8 +148,8 @@ export const FeilkortHeader = (props: IFeilmelding) => { {props.tittel}

{props.dato.toDateString()}

{props.beskrivelse}

-
- +
+
) } @@ -157,17 +157,39 @@ export const FeilkortHeader = (props: IFeilmelding) => { interface TagBarInterface { haster: boolean + arbeidsstatus: number } /** * Komponentet er en bar (vanrett linje) som inneholder to statusflagg: "arbeidsstatus" og "Haster". * Komponentet er en del av FeilKortHeader - * @param haster + * @param haster er en boolean som beskriver om feilen haster eller ikke. + * @param arbeidsstatus */ const TagBar = (props: TagBarInterface) => { + + /** + * Funksjonen tar inn + * @param arbeidsstatus + * @returns + */ + const toggleArbeidsstatus = (arbeidsstatus: number) => { + switch (arbeidsstatus) { + case 0: + return Ikke påbegynt; + case 1: + return Feilen jobbes med; + case 2: + return Feilen er fikset; + default: + throw new Error("Ikke gyldig arbeidsstatus-kode. Koden må være 0, 1 eller 2"); + + } + } + return ( -
- Jobbes med - {props.haster === true ? Haster : <>} +
+ {toggleArbeidsstatus(props.arbeidsstatus)} + {props.haster ? Haster : <>}
) } From 7a045bb0c3ec1703ccba3deeba1094f7d6cc54ff Mon Sep 17 00:00:00 2001 From: Sindre Kjelsrud Date: Tue, 1 Aug 2023 13:40:37 +0200 Subject: [PATCH 08/11] =?UTF-8?q?=F0=9F=90=9B=20Fikser=20slik=20at=20man?= =?UTF-8?q?=20kan=20skrive=20inn=20i=20feltene=20til=20tittel=20og=20beskr?= =?UTF-8?q?ivelse?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Markus A. R. Johansen --- frontend/src/components/FeilCard.tsx | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/frontend/src/components/FeilCard.tsx b/frontend/src/components/FeilCard.tsx index 6d0a8c4..9e08b4d 100644 --- a/frontend/src/components/FeilCard.tsx +++ b/frontend/src/components/FeilCard.tsx @@ -1,5 +1,5 @@ import "@navikt/ds-css"; -import { Button, Heading, Modal, Radio, RadioGroup, Tag, TextField } from "@navikt/ds-react"; +import { Button, Checkbox, CheckboxGroup, Heading, Modal, Radio, RadioGroup, Tag, TextField } from "@navikt/ds-react"; import { IFeilmelding } from "../interface"; import FeilModal from "./FeilModal"; import { useEffect, useState } from "react"; @@ -20,15 +20,19 @@ interface IFeilKort extends IFeilmelding { export const FeilKort = (props: IFeilKort) => { const [visModal, setVisModal] = useState(false) const [redigeringsmodus, setRedigeringsmodus] = useState(false) + const [tittel, setTittel] = useState(props.tittel) + const [beskrivelse, setBeskrivelse] = useState(props.beskrivelse) + const [arbeidsstatus, setArbeidsstatus] = useState(props.arbeidsstatus) + const [haster, setHaster] = useState(props.haster) + useEffect(() => { Modal.setAppElement(document.getElementById('root')); }, []); - const [arbeidsstatus, setArbeidsstatus] = useState(0) - const lagreEndringer = () => { setRedigeringsmodus(false) + // TODO - send endring til database } return( @@ -56,12 +60,13 @@ export const FeilKort = (props: IFeilKort) => {
setTittel(e.target.value)} /> setBeskrivelse(e.target.value)} /> { Feilen jobbes med Feilen er fikset + {setHaster(haster)}} + value={haster} + > + Ja + Nei +
: +
{
+
+
} -
{/* TODO: HER KOMMER CONTENT */} diff --git a/frontend/src/interface.ts b/frontend/src/interface.ts index 4757bd0..553ca65 100644 --- a/frontend/src/interface.ts +++ b/frontend/src/interface.ts @@ -4,6 +4,7 @@ export interface IFeilmelding { + id: number, tittel: string, beskrivelse: string dato: Date @@ -12,6 +13,7 @@ export interface IFeilmelding { } export class Feilmelding implements IFeilmelding { + id: number = 0 tittel: string = "default tittel" beskrivelse: string = "default beskrivelse" dato: Date = new Date() @@ -24,8 +26,9 @@ export class Feilmelding implements IFeilmelding { */ public constructor( fields: { - tittel: string, - beskrivelse: string, + id: number + tittel: string + beskrivelse: string dato: Date haster: boolean arbeidsstatus: number From 719a9b39efc62ed25834107c44840304bbc59cae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amalie=20Mans=C3=A5ker?= Date: Tue, 1 Aug 2023 14:11:52 +0200 Subject: [PATCH 10/11] =?UTF-8?q?=F0=9F=9A=A7=20P=C3=A5begynt=20oppdater?= =?UTF-8?q?=20feilmeldinger?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../no/nav/helse/sprik/db/FeilmeldingRepository.kt | 13 +++++++++++-- .../no/nav/helse/sprik/db/FeilmeldingTable.kt | 1 + .../kotlin/no/nav/helse/sprik/modell/Feilmelding.kt | 3 ++- .../kotlin/no/nav/helse/sprik/plugins/Routing.kt | 6 ++++++ backend/src/test/kotlin/LocalApp.kt | 12 ++++++------ .../kotlin/no/nav/helse/sprik/FeilmeldingTest.kt | 9 +++++++-- frontend/src/pages/feil.tsx | 1 + 7 files changed, 34 insertions(+), 11 deletions(-) diff --git a/backend/src/main/kotlin/no/nav/helse/sprik/db/FeilmeldingRepository.kt b/backend/src/main/kotlin/no/nav/helse/sprik/db/FeilmeldingRepository.kt index 85bca6c..1818dcc 100644 --- a/backend/src/main/kotlin/no/nav/helse/sprik/db/FeilmeldingRepository.kt +++ b/backend/src/main/kotlin/no/nav/helse/sprik/db/FeilmeldingRepository.kt @@ -5,6 +5,7 @@ import no.nav.helse.sprik.db.FeilmeldingTable.arbeidsstatus import no.nav.helse.sprik.db.FeilmeldingTable.beskrivelse import no.nav.helse.sprik.db.FeilmeldingTable.dato import no.nav.helse.sprik.db.FeilmeldingTable.haster +import no.nav.helse.sprik.db.FeilmeldingTable.id import no.nav.helse.sprik.db.FeilmeldingTable.tittel import no.nav.helse.sprik.modell.Feilmelding import org.jetbrains.exposed.sql.* @@ -20,14 +21,13 @@ class FeilmeldingRepository { it[FeilmeldingTable.tittel] = feilmelding.tittel it[FeilmeldingTable.beskrivelse] = feilmelding.beskrivelse it[FeilmeldingTable.dato] = feilmelding.dato - it[FeilmeldingTable.arbeidsstatus] = feilmelding.arbeidsstatus - it[FeilmeldingTable.haster] = feilmelding.haster } } } } private fun radTilFeilmelding(rad: ResultRow) = Feilmelding( + id = rad[id], tittel = rad[tittel], beskrivelse = rad[beskrivelse], dato = rad[dato], @@ -47,4 +47,13 @@ class FeilmeldingRepository { .map(::radTilFeilmelding) } + + fun hentFeilmelding(id: String) = transaction { + TODO() + FeilmeldingTable.id + } + + fun oppdaterFeilmelding(id: String): Nothing = transaction { + TODO() + } } diff --git a/backend/src/main/kotlin/no/nav/helse/sprik/db/FeilmeldingTable.kt b/backend/src/main/kotlin/no/nav/helse/sprik/db/FeilmeldingTable.kt index 13a2c35..34aacfb 100644 --- a/backend/src/main/kotlin/no/nav/helse/sprik/db/FeilmeldingTable.kt +++ b/backend/src/main/kotlin/no/nav/helse/sprik/db/FeilmeldingTable.kt @@ -4,6 +4,7 @@ import org.jetbrains.exposed.sql.Table import org.jetbrains.exposed.sql.javatime.datetime object FeilmeldingTable : Table("feilmelding") { + val id = integer("id") val tittel = text("tittel") val beskrivelse = text("beskrivelse") val dato = datetime("dato") diff --git a/backend/src/main/kotlin/no/nav/helse/sprik/modell/Feilmelding.kt b/backend/src/main/kotlin/no/nav/helse/sprik/modell/Feilmelding.kt index 7f14fe6..0e8c01c 100644 --- a/backend/src/main/kotlin/no/nav/helse/sprik/modell/Feilmelding.kt +++ b/backend/src/main/kotlin/no/nav/helse/sprik/modell/Feilmelding.kt @@ -14,10 +14,11 @@ import java.time.LocalDateTime * */ @Serializable class Feilmelding( + val id: Int?, val tittel: String, val beskrivelse: String, val dato: LocalDateTime, //Krever en spesiallaget serialiserer i KotlinX - val arbeidsstatus: Int, + val arbeidsstatus: Int?, val haster: Boolean //val bilde: String, ) { diff --git a/backend/src/main/kotlin/no/nav/helse/sprik/plugins/Routing.kt b/backend/src/main/kotlin/no/nav/helse/sprik/plugins/Routing.kt index e9fdc4d..a9be1d0 100644 --- a/backend/src/main/kotlin/no/nav/helse/sprik/plugins/Routing.kt +++ b/backend/src/main/kotlin/no/nav/helse/sprik/plugins/Routing.kt @@ -23,6 +23,7 @@ fun configureRouting(): ApplicationEngine = embeddedServer(CIO, applicationEngin anyHost() allowMethod(HttpMethod.Get) allowMethod(HttpMethod.Post) + allowMethod(HttpMethod.Put) allowNonSimpleContentTypes = true } install(ContentNegotiation) { @@ -61,6 +62,11 @@ fun configureRouting(): ApplicationEngine = embeddedServer(CIO, applicationEngin val sokeresultat = feilmeldingRepository.hentSokteFeilmeldinger(sokestreng) call.respond(status = HttpStatusCode.Created, message = sokeresultat) } + put("/api/oppdaterfeil/{id}") { + val id = call.parameters["id"] + val oppdatertFeilmelding = call.receive() + + } } } connector { diff --git a/backend/src/test/kotlin/LocalApp.kt b/backend/src/test/kotlin/LocalApp.kt index b3c8999..c8b3c1c 100644 --- a/backend/src/test/kotlin/LocalApp.kt +++ b/backend/src/test/kotlin/LocalApp.kt @@ -22,10 +22,10 @@ fun main() { private fun oppretteMockData() { val feilmeldingRepository = FeilmeldingRepository() - feilmeldingRepository.lagre(Feilmelding("Mangel på hensyn til tariffoppgjør", "Det har vært ett tariffoppgjør og speil sier sykepengene må tilbakekreves, noe som er feil. (sier vi.. har ikke domenekunnskap)", LocalDateTime.of(2023, 1, 1, 8, 0, 0), 0, false)) - feilmeldingRepository.lagre(Feilmelding("Speil sier NAV må tilbakekreve sykepenger på feil grunnlag", "Beskrivelse Test2", LocalDateTime.of(2023, 2, 1, 8, 0, 0), 1, true)) - feilmeldingRepository.lagre(Feilmelding("Feil A", "Lorem Ipsum", LocalDateTime.of(2023, 3, 1, 8, 0, 0), 2, false)) - feilmeldingRepository.lagre(Feilmelding("Feil B", "Lorem Ipsum", LocalDateTime.of(2023, 4, 1, 8, 0, 0), 1, true)) - feilmeldingRepository.lagre(Feilmelding("Feil C", "Lorem Ipsum", LocalDateTime.of(2023, 5, 1, 8, 0, 0), 1, true)) - feilmeldingRepository.lagre(Feilmelding("Feil D", "Lorem Ipsum", LocalDateTime.of(2023, 6, 1, 8, 0, 0), 0, false)) + feilmeldingRepository.lagre(Feilmelding(null, "Mangel på hensyn til tariffoppgjør", "Det har vært ett tariffoppgjør og speil sier sykepengene må tilbakekreves, noe som er feil. (sier vi.. har ikke domenekunnskap)", LocalDateTime.of(2023, 1, 1, 8, 0, 0), 0, false)) + feilmeldingRepository.lagre(Feilmelding(null, "Speil sier NAV må tilbakekreve sykepenger på feil grunnlag", "Beskrivelse Test2", LocalDateTime.of(2023, 2, 1, 8, 0, 0), 1, true)) + feilmeldingRepository.lagre(Feilmelding(null, "Feil A", "Lorem Ipsum", LocalDateTime.of(2023, 3, 1, 8, 0, 0), 2, false)) + feilmeldingRepository.lagre(Feilmelding(null, "Feil B", "Lorem Ipsum", LocalDateTime.of(2023, 4, 1, 8, 0, 0), 1, true)) + feilmeldingRepository.lagre(Feilmelding(null, "Feil C", "Lorem Ipsum", LocalDateTime.of(2023, 5, 1, 8, 0, 0), 1, true)) + feilmeldingRepository.lagre(Feilmelding(null, "Feil D", "Lorem Ipsum", LocalDateTime.of(2023, 6, 1, 8, 0, 0), 0, false)) } diff --git a/backend/src/test/kotlin/no/nav/helse/sprik/FeilmeldingTest.kt b/backend/src/test/kotlin/no/nav/helse/sprik/FeilmeldingTest.kt index c1ed9b1..2289b06 100644 --- a/backend/src/test/kotlin/no/nav/helse/sprik/FeilmeldingTest.kt +++ b/backend/src/test/kotlin/no/nav/helse/sprik/FeilmeldingTest.kt @@ -21,8 +21,8 @@ import org.jetbrains.exposed.sql.Database as ExposedDatabase class FeilmeldingTest { private val database = Database(dbconfig()).configureFlyway() private val feilmeldingRepository = FeilmeldingRepository() - private val feilmelding = Feilmelding("Test", "Testesen", LocalDateTime.of(2023,1,1,8,0), 0, true) - private val feilmelding2 = Feilmelding("Tittel", "Beskrivelse", LocalDateTime.of(2023,2,1,8,0), 1, false) + private val feilmelding = Feilmelding(1, "Test", "Testesen", LocalDateTime.of(2023,1,1,8,0), 0, true) + private val feilmelding2 = Feilmelding(2, "Tittel", "Beskrivelse", LocalDateTime.of(2023,2,1,8,0), 1, false) @BeforeAll fun setup() { @@ -101,4 +101,9 @@ class FeilmeldingTest { assertEquals("Test", sokeresultat[0].tittel) assertEquals("Testesen", sokeresultat[0].beskrivelse) } + + @Test + fun `Oppdaterer en feilmelding`() { + + } } \ No newline at end of file diff --git a/frontend/src/pages/feil.tsx b/frontend/src/pages/feil.tsx index ac0de6d..550b44d 100644 --- a/frontend/src/pages/feil.tsx +++ b/frontend/src/pages/feil.tsx @@ -12,6 +12,7 @@ export default function Feil() { const [tittel, setTittel] = useState(""); const [beskrivelse, setBeskrivelse] = useState(""); const [status, setStatus] = useState(0) + //const [haster, setHaster] = useState(false) const handleSubmit = () => { From 2017f1bcfb63bb36cad5b2caa67812e2c6871eaf Mon Sep 17 00:00:00 2001 From: Sindre Kjelsrud Date: Tue, 1 Aug 2023 14:55:45 +0200 Subject: [PATCH 11/11] =?UTF-8?q?=F0=9F=90=9B=20Fikset=20henting=20av=20ar?= =?UTF-8?q?beidsstatus=20og=20haster=20fra=20db?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Markus A. R. Johansen --- .../main/kotlin/no/nav/helse/sprik/db/FeilmeldingRepository.kt | 2 ++ .../src/main/kotlin/no/nav/helse/sprik/modell/Feilmelding.kt | 2 +- backend/src/main/kotlin/no/nav/helse/sprik/plugins/Routing.kt | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/backend/src/main/kotlin/no/nav/helse/sprik/db/FeilmeldingRepository.kt b/backend/src/main/kotlin/no/nav/helse/sprik/db/FeilmeldingRepository.kt index 1818dcc..d2cf565 100644 --- a/backend/src/main/kotlin/no/nav/helse/sprik/db/FeilmeldingRepository.kt +++ b/backend/src/main/kotlin/no/nav/helse/sprik/db/FeilmeldingRepository.kt @@ -21,6 +21,8 @@ class FeilmeldingRepository { it[FeilmeldingTable.tittel] = feilmelding.tittel it[FeilmeldingTable.beskrivelse] = feilmelding.beskrivelse it[FeilmeldingTable.dato] = feilmelding.dato + it[FeilmeldingTable.arbeidsstatus] = feilmelding.arbeidsstatus + it[FeilmeldingTable.haster] = feilmelding.haster } } } diff --git a/backend/src/main/kotlin/no/nav/helse/sprik/modell/Feilmelding.kt b/backend/src/main/kotlin/no/nav/helse/sprik/modell/Feilmelding.kt index 0e8c01c..82b14b4 100644 --- a/backend/src/main/kotlin/no/nav/helse/sprik/modell/Feilmelding.kt +++ b/backend/src/main/kotlin/no/nav/helse/sprik/modell/Feilmelding.kt @@ -18,7 +18,7 @@ class Feilmelding( val tittel: String, val beskrivelse: String, val dato: LocalDateTime, //Krever en spesiallaget serialiserer i KotlinX - val arbeidsstatus: Int?, + val arbeidsstatus: Int, val haster: Boolean //val bilde: String, ) { diff --git a/backend/src/main/kotlin/no/nav/helse/sprik/plugins/Routing.kt b/backend/src/main/kotlin/no/nav/helse/sprik/plugins/Routing.kt index a9be1d0..99e77a4 100644 --- a/backend/src/main/kotlin/no/nav/helse/sprik/plugins/Routing.kt +++ b/backend/src/main/kotlin/no/nav/helse/sprik/plugins/Routing.kt @@ -65,7 +65,7 @@ fun configureRouting(): ApplicationEngine = embeddedServer(CIO, applicationEngin put("/api/oppdaterfeil/{id}") { val id = call.parameters["id"] val oppdatertFeilmelding = call.receive() - + call.respond(status = HttpStatusCode.Created, message = "Feilmelding oppdatert") } } }