Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Oppdater tilganger felter #1882

Merged
merged 3 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading