Fix view schemas

This commit is contained in:
Adria Navarro 2024-08-29 13:56:42 +02:00
parent 637464e8b0
commit 40021ff602
2 changed files with 13 additions and 9 deletions

View File

@ -202,7 +202,9 @@ export async function enrichSchema(
const viewSchema = view.schema || {} const viewSchema = view.schema || {}
const anyViewOrder = Object.values(viewSchema).some(ui => ui.order != null) const anyViewOrder = Object.values(viewSchema).some(ui => ui.order != null)
for (const key of Object.keys(viewSchema)) { for (const key of Object.keys(tableSchema).filter(
k => tableSchema[k].visible !== false
)) {
// if nothing specified in view, then it is not visible // if nothing specified in view, then it is not visible
const ui = viewSchema[key] || { visible: false } const ui = viewSchema[key] || { visible: false }
schema[key] = { schema[key] = {

View File

@ -297,12 +297,6 @@ describe("table sdk", () => {
relationshipType: RelationshipType.ONE_TO_MANY, relationshipType: RelationshipType.ONE_TO_MANY,
fieldName: "table", fieldName: "table",
tableId: "otherTableId", tableId: "otherTableId",
schema: {
title: {
visible: true,
readonly: true,
},
},
}, },
}, },
} }
@ -334,7 +328,15 @@ describe("table sdk", () => {
tableId, tableId,
schema: { schema: {
name: { visible: true }, name: { visible: true },
other: { visible: true }, other: {
visible: true,
columns: {
title: {
visible: true,
readonly: true,
},
},
},
}, },
} }
@ -351,7 +353,7 @@ describe("table sdk", () => {
other: { other: {
...table.schema.other, ...table.schema.other,
visible: true, visible: true,
schema: { columns: {
title: { title: {
visible: true, visible: true,
readonly: true, readonly: true,