From b845b2d5411bc36c67648f141e2dac11a2e73d65 Mon Sep 17 00:00:00 2001 From: nijmra Date: Thu, 12 Dec 2024 17:37:59 +0100 Subject: [PATCH 1/2] added enums --- src/services/openklant2/types.ts | 59 ++++++++++++++++++++++++-------- 1 file changed, 44 insertions(+), 15 deletions(-) diff --git a/src/services/openklant2/types.ts b/src/services/openklant2/types.ts index 775dcb209..58023334d 100644 --- a/src/services/openklant2/types.ts +++ b/src/services/openklant2/types.ts @@ -166,33 +166,62 @@ export enum DigitaalAdresTypes { overig = "overig", } +export enum CodeRegister { + brp = "brp", + hr = "hr", + overig = "overig", +} + +export enum CodeObjecttype { + natuurlijkPersoon = "natuurlijkPersoon", + vestiging = "vestiging", + nietNatuurlijkPersoon = "nietNatuurlijkPersoon", + overig = "overig", +} + +export enum CodeSoortObjectId { + bsn = "bsn", + kvkNummer = "kvkNummer", + rsin = "rsin", + vestigingsnummer = "vestigingsnummer", + overig = "overig", +} + export type IdentificatorType = { - codeRegister: string; - codeSoortObjectId: string; - codeObjecttype: string; + codeRegister: CodeRegister; + codeSoortObjectId: CodeSoortObjectId; + codeObjecttype: CodeObjecttype; }; +// export const CodeRegister = Object.freeze({ +// brp: "brp", +// hr: "hr", +// overig: "overig", +// }); + +// type CodeRegister = keyof typeof CodeRegister; + // TODO in toekomstige story: waardes overleggen met Maykin en INFO export const identificatorTypes = { persoon: { - codeRegister: "brp", - codeSoortObjectId: "bsn", - codeObjecttype: "inp", + codeRegister: CodeRegister.brp, + codeSoortObjectId: CodeSoortObjectId.bsn, + codeObjecttype: CodeObjecttype.natuurlijkPersoon, }, vestiging: { - codeRegister: "hr", - codeSoortObjectId: "vtn", - codeObjecttype: "vst", + codeRegister: CodeRegister.hr, + codeSoortObjectId: CodeSoortObjectId.vestigingsnummer, + codeObjecttype: CodeObjecttype.vestiging, }, nietNatuurlijkPersoonRsin: { - codeRegister: "hr", - codeSoortObjectId: "rsin", - codeObjecttype: "nnp", + codeRegister: CodeRegister.hr, + codeSoortObjectId: CodeSoortObjectId.rsin, + codeObjecttype: CodeObjecttype.nietNatuurlijkPersoon, }, nietNatuurlijkPersoonKvkNummer: { - codeRegister: "hr", - codeSoortObjectId: "kvk", - codeObjecttype: "nnp", + codeRegister: CodeRegister.hr, + codeSoortObjectId: CodeSoortObjectId.kvkNummer, + codeObjecttype: CodeObjecttype.nietNatuurlijkPersoon, }, } satisfies Record; From 78b63e36b5217d526881eb0b42ae82dddf3b2553 Mon Sep 17 00:00:00 2001 From: nijmra Date: Mon, 16 Dec 2024 11:00:43 +0100 Subject: [PATCH 2/2] partijIdentificator CodeSoortObjectId --- src/services/openklant2/service.ts | 3 ++- src/services/openklant2/types.ts | 9 --------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/services/openklant2/service.ts b/src/services/openklant2/service.ts index eea042b35..97bb1678a 100644 --- a/src/services/openklant2/service.ts +++ b/src/services/openklant2/service.ts @@ -24,6 +24,7 @@ import { DigitaalAdresTypes, type OnderwerpObjectPostModel, type Betrokkene, + CodeSoortObjectId, } from "./types"; import type { ContactverzoekData } from "../../features/contact/components/types"; @@ -715,7 +716,7 @@ async function mapPartijToKlant( ?.filter((x) => x.adres && x.soortDigitaalAdres === type) .map((x) => x.adres || "") || []; - const getIdentificator = (type: { codeSoortObjectId: string }) => + const getIdentificator = (type: { codeSoortObjectId: CodeSoortObjectId }) => identificatoren?.find( (x) => x?.partijIdentificator?.objectId && diff --git a/src/services/openklant2/types.ts b/src/services/openklant2/types.ts index 58023334d..54bd24df1 100644 --- a/src/services/openklant2/types.ts +++ b/src/services/openklant2/types.ts @@ -193,15 +193,6 @@ export type IdentificatorType = { codeObjecttype: CodeObjecttype; }; -// export const CodeRegister = Object.freeze({ -// brp: "brp", -// hr: "hr", -// overig: "overig", -// }); - -// type CodeRegister = keyof typeof CodeRegister; - -// TODO in toekomstige story: waardes overleggen met Maykin en INFO export const identificatorTypes = { persoon: { codeRegister: CodeRegister.brp,