From 234499465a4111559e5673faa1dc07021ebafb65 Mon Sep 17 00:00:00 2001 From: Mohammer5 Date: Thu, 22 Feb 2024 03:12:50 +0800 Subject: [PATCH] fix(aggregation and value type fields): do not use generated types for validation --- src/pages/dataElements/fields/ValueTypeField.tsx | 1 + src/pages/dataElements/form/dataElementSchema.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pages/dataElements/fields/ValueTypeField.tsx b/src/pages/dataElements/fields/ValueTypeField.tsx index 481009fcb..57cd83056 100644 --- a/src/pages/dataElements/fields/ValueTypeField.tsx +++ b/src/pages/dataElements/fields/ValueTypeField.tsx @@ -59,6 +59,7 @@ export function ValueTypeField() { values.valueType === 'MULTI_TEXT' || (values.optionSet?.id && optionSetQuery.data?.optionSets.valueType === 'MULTI_TEXT') + const options = dataElement.properties.valueType.constants ?.map((constant) => ({ value: constant, diff --git a/src/pages/dataElements/form/dataElementSchema.ts b/src/pages/dataElements/form/dataElementSchema.ts index 00bf44b89..ce60b84d0 100644 --- a/src/pages/dataElements/form/dataElementSchema.ts +++ b/src/pages/dataElements/form/dataElementSchema.ts @@ -15,8 +15,8 @@ export const dataElementSchema = z icon: z.string().optional(), }), domainType: z.union([z.literal('AGGREGATE'), z.literal('TRACKER')]), - valueType: z.nativeEnum(DataElement.valueType), - aggregationType: z.nativeEnum(DataElement.aggregationType), + valueType: z.string(), + aggregationType: z.string(), optionSet: z.object({ id: z.string() }), commentOptionSet: z.object({ id: z.string() }), legendSets: z.array(z.object({ id: z.string() })),