Skip to content

Commit 5c292c4

Browse files
committed
chore: don't expect pdf in payload
1 parent ad085f0 commit 5c292c4

File tree

5 files changed

+6
-57
lines changed

5 files changed

+6
-57
lines changed

src/app/(fhir)/fhir/resources/sykmelding/[sykmeldingId]/route.ts

-1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,5 @@ function handleMockedRoute(): Response {
5252
code: 'L73',
5353
text: 'Brudd legg/ankel',
5454
},
55-
pdf: 'asdasdda',
5655
} satisfies ExistingSykmelding)
5756
}

src/app/(fhir)/fhir/resources/sykmelding/route.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { logger } from '@navikt/next-logger'
22

33
import { isE2E, isLocalOrDemo } from '@utils/env'
44
import { sykInnApiService } from '@services/syk-inn-api/SykInnApiService'
5-
import { ExistingSykmeldinger } from '@services/syk-inn-api/SykInnApiSchema'
5+
import { ExistingSykmelding } from '@services/syk-inn-api/SykInnApiSchema'
66
import { ensureValidFhirAuth } from '@fhir/auth/verify'
77

88
export async function GET(request: Request): Promise<Response> {
@@ -29,7 +29,7 @@ export async function GET(request: Request): Promise<Response> {
2929
return new Response('Failed to retrieve sykmeldinger', { status: 500 })
3030
}
3131

32-
return Response.json(sykmeldinger satisfies ExistingSykmeldinger[], { status: 200 })
32+
return Response.json(sykmeldinger satisfies ExistingSykmelding[], { status: 200 })
3333
}
3434

3535
function handleMockedRoute(): Response {
@@ -83,5 +83,5 @@ function handleMockedRoute(): Response {
8383
text: 'Brudd legg/ankel',
8484
},
8585
},
86-
] satisfies ExistingSykmeldinger[])
86+
] satisfies ExistingSykmelding[])
8787
}

src/data-fetcher/data-service.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { ExistingSykmeldinger } from '@services/syk-inn-api/SykInnApiSchema'
2-
31
export type NotAvailable = typeof NotAvailable
42
export const NotAvailable = {
53
type: 'resource-not-available',
@@ -25,7 +23,7 @@ export type DataService = {
2523
pasient: (() => Promise<PasientInfo>) | NotAvailable
2624
arbeidsgivere: (() => Promise<ArbeidsgiverInfo[]>) | NotAvailable
2725
konsultasjon: (() => Promise<KonsultasjonInfo>) | NotAvailable
28-
tidligereSykmeldinger: (() => Promise<ExistingSykmeldinger[]>) | NotAvailable
26+
tidligereSykmeldinger: (() => Promise<ExistingSykmelding[]>) | NotAvailable
2927
}
3028
/**
3129
* Query data can be anything that requires an argument to fetch, such as a specific patient.
@@ -123,7 +121,6 @@ export type ExistingSykmelding = {
123121
code: string
124122
text: string
125123
}
126-
pdf: string
127124
}
128125

129126
/**

src/services/syk-inn-api/SykInnApiSchema.ts

-45
Original file line numberDiff line numberDiff line change
@@ -29,51 +29,6 @@ export const ExistingSykmeldingSchema = z.object({
2929
code: z.string(),
3030
text: z.string(),
3131
}),
32-
pdf: z.string(),
33-
})
34-
35-
export type ExistingSykmeldinger = z.infer<typeof ExistingSykmeldingerSchema>
36-
export const ExistingSykmeldingerSchema = z.object({
37-
sykmeldingId: z.string(),
38-
pasient: z.object({
39-
fnr: z.string(),
40-
}),
41-
aktivitet: z.discriminatedUnion('type', [
42-
z.object({
43-
type: z.literal('AKTIVITET_IKKE_MULIG'),
44-
fom: DateOnly,
45-
tom: DateOnly,
46-
}),
47-
z.object({
48-
type: z.literal('GRADERT'),
49-
fom: DateOnly,
50-
tom: DateOnly,
51-
grad: z
52-
.string()
53-
.transform((it) => +it)
54-
.pipe(z.number().min(1).max(99)),
55-
}),
56-
z.object({
57-
type: z.literal('AVVENTENDE'),
58-
fom: DateOnly,
59-
tom: DateOnly,
60-
}),
61-
z.object({
62-
type: z.literal('BEHANDLINGSDAGER'),
63-
fom: DateOnly,
64-
tom: DateOnly,
65-
}),
66-
z.object({
67-
type: z.literal('REISETILSKUDD'),
68-
fom: DateOnly,
69-
tom: DateOnly,
70-
}),
71-
]),
72-
hovedDiagnose: z.object({
73-
system: z.string(),
74-
code: z.string(),
75-
text: z.string(),
76-
}),
7732
})
7833

7934
export type NySykmelding = z.infer<typeof NySykmeldingSchema>

src/services/syk-inn-api/SykInnApiService.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import {
22
ExistingSykmelding,
3-
ExistingSykmeldinger,
4-
ExistingSykmeldingerSchema,
53
ExistingSykmeldingSchema,
64
NySykmelding,
75
NySykmeldingSchema,
@@ -54,7 +52,7 @@ export const sykInnApiService = {
5452
},
5553
responseSchema: ExistingSykmeldingSchema,
5654
}),
57-
getTidligereSykmeldinger: async (ident: string): Promise<ExistingSykmeldinger[] | ApiFetchErrors> =>
55+
getTidligereSykmeldinger: async (ident: string): Promise<ExistingSykmelding[] | ApiFetchErrors> =>
5856
fetchInternalAPI({
5957
api: 'syk-inn-api',
6058
path: `/api/v1/sykmelding`,
@@ -63,6 +61,6 @@ export const sykInnApiService = {
6361
'Content-Type': 'application/json',
6462
Ident: ident,
6563
},
66-
responseSchema: ExistingSykmeldingerSchema.array(),
64+
responseSchema: ExistingSykmeldingSchema.array(),
6765
}),
6866
}

0 commit comments

Comments
 (0)