Don't trim usertable

This commit is contained in:
Adria Navarro 2024-08-14 12:51:46 +02:00
parent ce8730f176
commit da87c0233b
1 changed files with 12 additions and 9 deletions

View File

@ -33,6 +33,7 @@ import {
PROTECTED_INTERNAL_COLUMNS, PROTECTED_INTERNAL_COLUMNS,
} from "@budibase/shared-core" } from "@budibase/shared-core"
import { processString } from "@budibase/string-templates" import { processString } from "@budibase/string-templates"
import { isUserMetadataTable } from "../../api/controllers/row/utils"
export * from "./utils" export * from "./utils"
export * from "./attachments" export * from "./attachments"
@ -359,16 +360,18 @@ export async function outputProcessing<T extends Row[] | Row>(
} }
} }
const protectedColumns = isExternal if (!isUserMetadataTable(table._id!)) {
? PROTECTED_EXTERNAL_COLUMNS const protectedColumns = isExternal
: PROTECTED_INTERNAL_COLUMNS ? PROTECTED_EXTERNAL_COLUMNS
: PROTECTED_INTERNAL_COLUMNS
const tableFields = Object.keys(table.schema).filter( const tableFields = Object.keys(table.schema).filter(
f => table.schema[f].visible !== false f => table.schema[f].visible !== false
) )
enriched = enriched.map((r: Row) => enriched = enriched.map((r: Row) =>
pick(r, [...tableFields, ...protectedColumns]) pick(r, [...tableFields, ...protectedColumns])
) )
}
return (wasArray ? enriched : enriched[0]) as T return (wasArray ? enriched : enriched[0]) as T
} }