1
0
Fork 0
mirror of synced 2024-09-09 22:16:26 +12:00

Validate that required fields can't be hidden in views

This commit is contained in:
Adria Navarro 2024-06-03 12:43:51 +02:00
parent 91c20213dc
commit c1b760ca9e

View file

@ -74,7 +74,15 @@ async function guardViewSchema(
}
const viewSchemaField = viewSchema[field.name]
if (viewSchemaField?.readonly) {
if (!viewSchemaField?.visible) {
throw new HTTPError(
`You can't hide the required field "${field.name}"`,
400
)
}
if (viewSchemaField.readonly) {
throw new HTTPError(
`You can't make read only the required field "${field.name}"`,
400