Don't check required fields at all for calculation views.

This commit is contained in:
Sam Rose 2024-10-07 16:39:44 +01:00
parent e6e25fdf94
commit f2e78ec4d5
No known key found for this signature in database
1 changed files with 6 additions and 3 deletions

View File

@ -114,7 +114,11 @@ async function guardViewSchema(
}
await checkReadonlyFields(table, view)
checkRequiredFields(table, view)
if (!helpers.views.isCalculationView(view)) {
checkRequiredFields(table, view)
}
checkDisplayField(view)
}
@ -178,7 +182,7 @@ function checkRequiredFields(
continue
}
if (!helpers.views.isCalculationView(view) && !viewSchemaField?.visible) {
if (!viewSchemaField?.visible) {
throw new HTTPError(
`You can't hide "${field.name}" because it is a required field.`,
400
@ -186,7 +190,6 @@ function checkRequiredFields(
}
if (
viewSchemaField &&
helpers.views.isBasicViewField(viewSchemaField) &&
viewSchemaField.readonly
) {