From c63465db5f3aa99b48b481b87467d5b31aa990ea Mon Sep 17 00:00:00 2001 From: Pl217 Date: Mon, 30 Dec 2024 16:19:47 +0100 Subject: [PATCH] Disallow `null` elements in `support` array After fixing all the records which had `null` in `support` array, we can simplify the codec --- src/db/models/planEntityVersion.ts | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/db/models/planEntityVersion.ts b/src/db/models/planEntityVersion.ts index c25c3f9..a906113 100644 --- a/src/db/models/planEntityVersion.ts +++ b/src/db/models/planEntityVersion.ts @@ -33,17 +33,7 @@ export const PLAN_ENTITY_VERSION_VALUE = t.type({ categories: t.array(CATEGORY_ID), description: t.string, type: LOCALIZED_PLURAL_STRING, - support: t.array( - t.union([ - /** - * TODO: Some records in the database have `null` inside `support` array, - * which is problematic. Stricter validation of data being stored should - * be done, existing values removed and then `null` removed from this type. - */ - t.null, - PLAN_ENTITY_VERSION_REF, - ]) - ), + support: t.array(PLAN_ENTITY_VERSION_REF), }); export type PlanEntityVersionValue = t.TypeOf;