Skip to content

Commit

Permalink
Lager mock av finnHjelpemiddel som brukes lokalt og i "labs". Innehol…
Browse files Browse the repository at this point in the history
…der et litt mindre utvalg enn full sortimentfila fra grunndata
  • Loading branch information
matsbyfl committed Feb 13, 2024
1 parent 77cd207 commit 4ac428b
Show file tree
Hide file tree
Showing 11 changed files with 348 additions and 28,210 deletions.
1 change: 0 additions & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@
"cypress:open": "cypress open",
"cypress:run": "cypress run",
"codegen": "graphql-codegen --config finnhjelpemiddel-codegen.yml",
"grunndata-codegen": "graphql-codegen --config grunndata-codegen.yml",
"lint": "eslint . --ext .ts,.tsx",
"prettier": "prettier -w ./src",
"clean": "rimraf ./dist"
Expand Down
1 change: 1 addition & 0 deletions client/src/generated/finnhjelpemiddel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ export interface HMDBProduct {
isoCategoryText?: Maybe<Scalars['String']['output']>;
isoCategoryTextShort?: Maybe<Scalars['String']['output']>;
isoCategoryTitle?: Maybe<Scalars['String']['output']>;
isoCategoryTitleShort?: Maybe<Scalars['String']['output']>;
media: Array<HMDBMediaDoc>;
productURL: Scalars['String']['output'];
productVariantURL: Scalars['String']['output'];
Expand Down
26 changes: 20 additions & 6 deletions client/src/mocks/data/HjelpemiddelStore.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import Dexie, { Table } from 'dexie'

import { HMDBHentProduktQuery } from '../../generated/hjelpemiddeldatabasen'
import grunndataGraphQL from './grunndataGraphQL.json'
import { HMDBHentProdukterQuery } from '../../generated/finnhjelpemiddel'
import finnHjelpemiddelGraphQLMock from './finnHjelpemiddelGraphQLMock.json'

type LagretHjelpemiddel = HMDBHentProduktQuery['produkter'][0]
type LagretHjelpemiddel = HMDBHentProdukterQuery['products'][0]

const fjes: LagretHjelpemiddel = finnHjelpemiddelGraphQLMock.data.products[0]
export class HjelpemiddelStore extends Dexie {
private readonly hjelpemidler!: Table<LagretHjelpemiddel, string>

constructor() {
super('HjelpemiddelStore')
this.version(1).stores({
hjelpemidler: 'hmsnr',
hjelpemidler: 'hmsArtNr',
})
}

Expand All @@ -20,10 +21,23 @@ export class HjelpemiddelStore extends Dexie {
if (count !== 0) {
return []
}
return this.hjelpemidler.bulkAdd(grunndataGraphQL, { allKeys: true }).catch(console.warn)
return this.hjelpemidler.bulkAdd(finnHjelpemiddelGraphQLMock.data.products, { allKeys: true }).catch(console.warn)
}

async hent(hmsnr: string) {
return this.hjelpemidler.get(hmsnr)
const hmsArtNr = hmsnr
return (await this.hjelpemidler.get(hmsArtNr)) || mockHjelpemiddel
}
}

const mockHjelpemiddel = {
hmsArtNr: '112233',
articleName: 'Hjelpemiddelnavn',
isoCategoryTitle: 'ISO kategori',
productVariantURL: 'https://finnhjelpemiddel.nav.no/produkt/HMDB-65088',
agreements: [
{
postTitle: 'Post 42: Posttittel',
},
],
}
295 changes: 295 additions & 0 deletions client/src/mocks/data/finnHjelpemiddelGraphQLMock.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,295 @@
{
"data": {
"products": [
{
"hmsArtNr": "014112",
"articleName": "Topro terskeleliminator",
"isoCategoryTitle": "Terskeleliminatorer",
"productVariantURL": "https://finnhjelpemiddel.nav.no/produkt/HMDB-30418",
"agreements": [
{
"postTitle": "Post 1: Terskeleliminator - påkjøring fra en side, for innendørs og begrenset utendørs bruk"
}
]
},
{
"hmsArtNr": "289689",
"articleName": "Varslingsmottaker Nora Flexiwatch, LIFE",
"isoCategoryTitle": "Indikatorer med lyssignaler",
"productVariantURL": "https://finnhjelpemiddel.nav.no/produkt/HMDB-65088",
"agreements": [
{
"postTitle": "Post 8: Trådløs varsling til nærpersoner"
},
{
"postTitle": "Post 9: Tilkalling - sender uten bryter"
},
{
"postTitle": "Post 13: Varslingssystem"
}
]
},
{
"hmsArtNr": "174791",
"articleName": "Puls NAV 90 x 200",
"isoCategoryTitle": "Madrasser skumbaserte",
"productVariantURL": "https://finnhjelpemiddel.nav.no/produkt/HMDB-64443",
"agreements": []
},
{
"hmsArtNr": "231053",
"articleName": "Hiro180 høyre",
"isoCategoryTitle": "Trappeheiser med sete",
"productVariantURL": "https://finnhjelpemiddel.nav.no/produkt/HMDB-49649",
"agreements": [
{
"postTitle": "Post 13: Trappeheis med sete for trapp med sving/repos "
}
]
},
{
"hmsArtNr": "235352",
"articleName": "Gemino 30M Parkinson",
"isoCategoryTitle": "Rullatorer, 4 hjul innendørsbruk, begrenset utebruk",
"productVariantURL": "https://finnhjelpemiddel.nav.no/produkt/HMDB-47681",
"agreements": [
{
"postTitle": "6. Rullator - brukere med akinesi"
}
]
},
{
"hmsArtNr": "170093",
"articleName": "Eliramp",
"isoCategoryTitle": "Terskeleliminatorer",
"productVariantURL": "https://finnhjelpemiddel.nav.no/produkt/HMDB-30381",
"agreements": [
{
"postTitle": "Post 1: Terskeleliminator - påkjøring fra en side, for innendørs og begrenset utendørs bruk"
}
]
},
{
"hmsArtNr": "171506",
"articleName": "Basic Cushion 38x44",
"isoCategoryTitle": "Sitteputer for komfort",
"productVariantURL": "https://finnhjelpemiddel.nav.no/produkt/HMDB-29744",
"agreements": [
{
"postTitle": "Post 1: Enkel sittepute"
}
]
},
{
"hmsArtNr": "171509",
"articleName": "Basic Cushion 40x44",
"isoCategoryTitle": "Sitteputer for komfort",
"productVariantURL": "https://finnhjelpemiddel.nav.no/produkt/HMDB-29744",
"agreements": [
{
"postTitle": "Post 1: Enkel sittepute"
}
]
},
{
"hmsArtNr": "177946",
"articleName": "Gemino 20",
"isoCategoryTitle": "Rullatorer, 4 hjul innendørsbruk, begrenset utebruk",
"productVariantURL": "https://finnhjelpemiddel.nav.no/produkt/HMDB-34825",
"agreements": [
{
"postTitle": "2. Rullator - innendørs bruk"
}
]
},
{
"hmsArtNr": "241475",
"articleName": "Nova 30",
"isoCategoryTitle": "Løftestoler med individuell regulering av rygg, benstøtter og oppreisning",
"productVariantURL": "https://finnhjelpemiddel.nav.no/produkt/HMDB-54608",
"agreements": []
},
{
"hmsArtNr": "097820",
"articleName": "Aquatec 90000 10 cm",
"isoCategoryTitle": "Faste toalettforhøyere",
"productVariantURL": "https://finnhjelpemiddel.nav.no/produkt/HMDB-24489",
"agreements": []
},
{
"hmsArtNr": "072517",
"articleName": "Topro Taurus E Premium",
"isoCategoryTitle": "Gåbord med støttebord",
"productVariantURL": "https://finnhjelpemiddel.nav.no/produkt/HMDB-47755",
"agreements": [
{
"postTitle": "10. Gåbord - støttebord og elektrisk høyderegulering til innendørs bruk "
}
]
},
{
"hmsArtNr": "250470",
"articleName": "Minicrosser X1 4W CAB",
"isoCategoryTitle": "Elektriske rullestoler manuell styring utebruk",
"productVariantURL": "https://finnhjelpemiddel.nav.no/produkt/HMDB-61673",
"agreements": []
},
{
"hmsArtNr": "286589",
"articleName": "Topro Olympos ATR M",
"isoCategoryTitle": "Rullatorer, 4 hjul utebruk",
"productVariantURL": "https://finnhjelpemiddel.nav.no/produkt/HMDB-64912",
"agreements": []
},
{
"hmsArtNr": "215765",
"articleName": "E-fix E35 24 tommer",
"isoCategoryTitle": "Drivhjul og drivaggregat med motorisert styring",
"productVariantURL": "https://finnhjelpemiddel.nav.no/produkt/HMDB-48258",
"agreements": [
{
"postTitle": "Post 17: Drivaggregat med motorisert styring - brukerstyrt "
}
]
},
{
"hmsArtNr": "174787",
"articleName": "Puls NAV 85 x 200",
"isoCategoryTitle": "Madrasser skumbaserte",
"productVariantURL": "https://finnhjelpemiddel.nav.no/produkt/HMDB-64443",
"agreements": []
},
{
"hmsArtNr": "243548",
"articleName": "Topro høydejusterbart skråbrett",
"isoCategoryTitle": "Terskeleliminatorer",
"productVariantURL": "https://finnhjelpemiddel.nav.no/produkt/HMDB-30389",
"agreements": [
{
"postTitle": "Post 3: Terskeleliminator - påkjøring fra en side, for utendørs bruk"
}
]
},
{
"hmsArtNr": "166438",
"articleName": "Dorma ED 100 LE",
"isoCategoryTitle": "Åpnere og lukkere til dører",
"productVariantURL": "https://finnhjelpemiddel.nav.no/produkt/HMDB-28737",
"agreements": []
},
{
"hmsArtNr": "019161",
"articleName": "Etac Swift",
"isoCategoryTitle": "Dusjkrakker",
"productVariantURL": "https://finnhjelpemiddel.nav.no/produkt/HMDB-24586",
"agreements": []
},
{
"hmsArtNr": "214967",
"articleName": "Opus 90c",
"isoCategoryTitle": "Senger med elektrisk regulering av liggeflaten",
"productVariantURL": "https://finnhjelpemiddel.nav.no/produkt/HMDB-47144",
"agreements": []
},
{
"hmsArtNr": "255799",
"articleName": "Opus 90DW",
"isoCategoryTitle": "Senger med elektrisk regulering av liggeflaten",
"productVariantURL": "https://finnhjelpemiddel.nav.no/produkt/HMDB-64440",
"agreements": []
},
{
"hmsArtNr": "089700",
"articleName": "Regncape Omega M-L",
"isoCategoryTitle": "Regntøy",
"productVariantURL": "https://finnhjelpemiddel.nav.no/produkt/HMDB-20529",
"agreements": [
{
"postTitle": "Post 5: Regncape med ermer - voksne, til bruk i rullestol med høy rygg"
}
]
},
{
"hmsArtNr": "216075",
"articleName": "Hepro E2 Basic 15 M",
"isoCategoryTitle": "Arbeidsstoler med elektrisk seteløfter",
"productVariantURL": "https://finnhjelpemiddel.nav.no/produkt/HMDB-48196",
"agreements": []
},
{
"hmsArtNr": "184973",
"articleName": "XLT Swing",
"isoCategoryTitle": "Manuelle rullestoler aktive",
"productVariantURL": "https://finnhjelpemiddel.nav.no/produkt/HMDB-37314",
"agreements": []
},
{
"hmsArtNr": "229770",
"articleName": "Compact Attract",
"isoCategoryTitle": "Manuelle rullestoler aktive",
"productVariantURL": "https://finnhjelpemiddel.nav.no/produkt/HMDB-48881",
"agreements": []
},
{
"hmsArtNr": "176787",
"articleName": "Topro Trillebord",
"isoCategoryTitle": "Traller og trillebord",
"productVariantURL": "https://finnhjelpemiddel.nav.no/produkt/HMDB-35624",
"agreements": []
},
{
"hmsArtNr": "199325",
"articleName": "DS130",
"isoCategoryTitle": "Dusjkrakker",
"productVariantURL": "https://finnhjelpemiddel.nav.no/produkt/HMDB-42236",
"agreements": []
},
{
"hmsArtNr": "247627",
"articleName": "Jay Easy Visco Cushion 40x42 buet",
"isoCategoryTitle": "Sitteputer for komfort",
"productVariantURL": "https://finnhjelpemiddel.nav.no/produkt/HMDB-60048",
"agreements": [
{
"postTitle": "Post 2: Sittepute som ikke kan innstilles - lav modell"
}
]
},
{
"hmsArtNr": "286813",
"articleName": "CuroCell M4 CX10 90x200",
"isoCategoryTitle": "Overmadrasser dynamiske",
"productVariantURL": "https://finnhjelpemiddel.nav.no/produkt/HMDB-64916",
"agreements": []
},
{
"hmsArtNr": "289732",
"articleName": "Hodebøylemikrofon, mod. 10 med VA-sender",
"isoCategoryTitle": "Mikrofoner",
"productVariantURL": "https://finnhjelpemiddel.nav.no/produkt/HMDB-65114",
"agreements": [
{
"postTitle": "Post 10: Samtaleanlegg med høyttaler, portabelt"
},
{
"postTitle": "Post 11: Samtaleanlegg med høyttaler(e), stasjonært"
}
]
},
{
"hmsArtNr": "186868",
"articleName": "Impera",
"isoCategoryTitle": "Manuelle rullestoler aktive",
"productVariantURL": "https://finnhjelpemiddel.nav.no/produkt/HMDB-36743",
"agreements": []
},
{
"hmsArtNr": "217574",
"articleName": "Invacare 9630 Styxo",
"isoCategoryTitle": "Frittstående toalettforhøyere",
"productVariantURL": "https://finnhjelpemiddel.nav.no/produkt/HMDB-54931",
"agreements": []
}
]
}
}
Loading

0 comments on commit 4ac428b

Please sign in to comment.