Fix retrieve

This commit is contained in:
Adria Navarro 2024-08-28 14:20:39 +02:00
parent 0dba593bdb
commit e1add8dd6a
2 changed files with 784 additions and 783 deletions

File diff suppressed because it is too large Load Diff

View File

@ -13,7 +13,6 @@ import {
PROTECTED_EXTERNAL_COLUMNS,
PROTECTED_INTERNAL_COLUMNS,
} from "@budibase/shared-core"
import { cloneDeep } from "lodash/fp"
import * as utils from "../../../db/utils"
import { isExternalTableID } from "../../../integrations/utils"
@ -163,17 +162,19 @@ export function enrichSchema(
view: ViewV2,
tableSchema: TableSchema
): ViewV2Enriched {
let schema = cloneDeep(tableSchema)
let schema: TableSchema = {}
const anyViewOrder = Object.values(view.schema || {}).some(
ui => ui.order != null
)
for (const key of Object.keys(schema)) {
for (const key of Object.keys(tableSchema).filter(
key => tableSchema[key].visible !== false
)) {
// if nothing specified in view, then it is not visible
const ui = view.schema?.[key] || { visible: false }
schema[key] = {
...schema[key],
...tableSchema[key],
...ui,
order: anyViewOrder ? ui?.order ?? undefined : schema[key].order,
order: anyViewOrder ? ui?.order ?? undefined : tableSchema[key].order,
}
}