mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-17 07:42:23 +00:00
feat(profile): capture the insurer IK number
Add an optional German insurer institution number (IKNR, 9 digits) to the user profile, alongside the existing insurer name and KVNR. The IKNR is a public registry identifier for the institution, not a per-person quasi-identifier, so it is stored plaintext, matching insurer_name rather than the encrypted KVNR column. The profile GET echoes the field; PATCH/PUT accept it via Zod — optional, empty string maps to null, and a non-empty value must be exactly 9 digits (422 otherwise, no checksum). The write is built field-by-field. /api/user/profile gains an OpenAPI registration with the profile read/write schemas. Migration 0102 adds the nullable column, NULL-defaulted, forward-only.
This commit is contained in:
1 parent
9ecd798119
commit
b99b07ad38
15 files changed
+645
No files matched your search
@@ -58,6 +58,23 @@ export const profileSchema = z.object({
|
||||
.refine((v) => v === null || v === undefined || isValidKvnr(v), {
|
||||
message: "Invalid insurance number (KVNR)",
|
||||
}),
|
||||
// v1.8.6 — German insurer institution number (IKNR). Optional;
|
||||
// empty string / null clears it. A non-empty value is trimmed and
|
||||
// must be exactly 9 digits (no checksum — the IKNR carries a mod-10
|
||||
// check digit but we deliberately do not enforce it here, mirroring
|
||||
// the iOS client contract). Surfaced on the FHIR `Coverage` payor.
|
||||
insurerIkNumber: z
|
||||
.string()
|
||||
.nullable()
|
||||
.optional()
|
||||
.transform((v) => {
|
||||
if (v === null || v === undefined) return v;
|
||||
const trimmed = v.trim();
|
||||
return trimmed.length === 0 ? null : trimmed;
|
||||
})
|
||||
.refine((v) => v === null || v === undefined || /^[0-9]{9}$/.test(v), {
|
||||
message: "Invalid insurer IK number (expected 9 digits)",
|
||||
}),
|
||||
});
|
||||
|
||||
export const changePasswordSchema = z
|
||||
|
||||
Reference in new issue
Block a user