Skip to content

Commit

Permalink
Merge pull request #1882 from navikt/oppdater_tilganger_felter
Browse files Browse the repository at this point in the history
Oppdater tilganger felter
  • Loading branch information
kenglxn authored Nov 1, 2024
2 parents 8b8f84e + 07ea433 commit a5f8294
Show file tree
Hide file tree
Showing 9 changed files with 124 additions and 132 deletions.
9 changes: 4 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"@grafana/faro-web-sdk": "1.3.6",
"@navikt/aksel-icons": "^5.17.2",
"@navikt/arbeidsgiver-notifikasjon-widget": "7.1.2",
"@navikt/bedriftsmeny": "7.0.1",
"@navikt/bedriftsmeny": "7.0.3",
"@navikt/ds-css": "^6.15.0",
"@navikt/ds-icons": "3.4.3",
"@navikt/ds-react": "^6.15.0",
Expand Down
111 changes: 54 additions & 57 deletions server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"@navikt/oasis": "3.4.0",
"express": "^4.20.0",
"express-http-proxy": "2.0.0",
"http-proxy-middleware": "3.0.0",
"http-proxy-middleware": "3.0.3",
"http-terminator": "3.2.0",
"jsdom": "^24.1.0",
"mustache": "^4.2.0",
Expand Down
10 changes: 5 additions & 5 deletions src/hooks/useUserInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import * as Record from '../utils/Record';
import { Set } from 'immutable';
import { useState } from 'react';
import { erDriftsforstyrrelse } from '../utils/util';
import { flatUtOrganisasjonstre } from '@navikt/bedriftsmeny';
import { flatUtOrganisasjonstreV2 } from '@navikt/bedriftsmeny';

const DigiSyfoOrganisasjon = z.object({
organisasjon: Organisasjon,
Expand Down Expand Up @@ -37,9 +37,9 @@ const idLookup = (id: string) => tjenesteTilIdMap[id] ?? id;

// recursive type using zod https://zodjs.netlify.app/guide/recursive-types#recursive-types
const BaseAltinnTilgang = z.object({
orgNr: z.string(),
name: z.string(),
organizationForm: z.string(),
orgnr: z.string(),
navn: z.string(),
organisasjonsform: z.string(),
});
export type AltinnTilgang = z.infer<typeof BaseAltinnTilgang> & {
underenheter: AltinnTilgang[];
Expand All @@ -52,7 +52,7 @@ const UserInfoRespons = z.object({
digisyfoError: z.boolean(),
organisasjoner: z
.array(AltinnTilgang)
.transform((organisasjoner) => flatUtOrganisasjonstre(organisasjoner)),
.transform((organisasjoner) => flatUtOrganisasjonstreV2(organisasjoner)),
tilganger: z.record(z.string(), z.array(z.string())).transform((tilganger) => {
return Record.fromEntries(
Object.entries(tilganger).map(([id, orgnumre]) => [idLookup(id), Set(orgnumre)])
Expand Down
40 changes: 20 additions & 20 deletions src/mocks/scenarios/dagligLederScenario.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,48 +36,48 @@ export const dagligLederScenario = [
http.get('/min-side-arbeidsgiver/api/userInfo/v2', () => {
const underenheter = [
{
orgNr: orgnr(),
orgnr: orgnr(),
underenheter: [],
name: faker.company.name(),
organizationForm: 'AAFY',
navn: faker.company.name(),
organisasjonsform: 'AAFY',
},
{
orgNr: orgnr(),
orgnr: orgnr(),
underenheter: [],
name: faker.company.name(),
organizationForm: 'FLI',
navn: faker.company.name(),
organisasjonsform: 'FLI',
},
{
orgNr: orgnr(),
name: faker.company.name(),
organizationForm: 'BEDR',
orgnr: orgnr(),
navn: faker.company.name(),
organisasjonsform: 'BEDR',
underenheter: [],
},
];
const organisasjon = {
orgNr: orgnr(),
name: faker.company.name(),
organizationForm: 'AS',
orgnr: orgnr(),
navn: faker.company.name(),
organisasjonsform: 'AS',
underenheter,
};
return HttpResponse.json({
altinnError: false,
organisasjoner: [organisasjon],
tilganger: fromEntries(
alleTilganger.map((tilgang) => [tilgang, underenheter.map((org) => org.orgNr)])
alleTilganger.map((tilgang) => [tilgang, underenheter.map((org) => org.orgnr)])
),
digisyfoError: false,
digisyfoOrganisasjoner: underenheter.map(({ orgNr, organizationForm, name }) => ({
digisyfoOrganisasjoner: underenheter.map(({ orgnr, organisasjonsform, navn }) => ({
organisasjon: {
OrganizationNumber: orgNr,
Name: name,
ParentOrganizationNumber: organisasjon.orgNr,
OrganizationForm: organizationForm,
OrganizationNumber: orgnr,
Name: navn,
ParentOrganizationNumber: organisasjon.orgnr,
OrganizationForm: organisasjonsform,
},
antallSykmeldte: faker.number.int({ min: 0, max: 10 }),
})),
refusjoner: underenheter.map(({ orgNr }) => ({
virksomhetsnummer: orgNr,
refusjoner: underenheter.map(({ orgnr }) => ({
virksomhetsnummer: orgnr,
statusoversikt: {
KLAR_FOR_INNSENDING: faker.number.int({ min: 0, max: 10 }),
FOR_TIDLIG: faker.number.int({ min: 0, max: 10 }),
Expand Down
Loading

0 comments on commit a5f8294

Please sign in to comment.