1
0
Fork 0
mirror of synced 2024-09-12 23:43:09 +12:00

Treat deprecatedSingleUserColumn as single on inputting

This commit is contained in:
Adria Navarro 2024-05-14 17:48:10 +02:00
parent efb02a2c44
commit 092e75ed6c
2 changed files with 14 additions and 8 deletions

View file

@ -14,11 +14,13 @@ export async function processInputBBReference(
subtype: BBReferenceFieldSubType.USER subtype: BBReferenceFieldSubType.USER
): Promise<string | null> { ): Promise<string | null> {
if (value && Array.isArray(value)) { if (value && Array.isArray(value)) {
throw new InvalidBBRefError( if (value.length > 1) {
JSON.stringify(value), throw new InvalidBBRefError(
BBReferenceFieldSubType.USER, JSON.stringify(value),
"BB_REFERENCE_SINGLE cannot be an array" BBReferenceFieldSubType.USER
) )
}
value = value[0]
} }
let id = typeof value === "string" ? value : value?._id let id = typeof value === "string" ? value : value?._id

View file

@ -18,6 +18,7 @@ import {
processOutputBBReferences, processOutputBBReferences,
} from "./bbReferenceProcessor" } from "./bbReferenceProcessor"
import { isExternalTableID } from "../../integrations/utils" import { isExternalTableID } from "../../integrations/utils"
import { helpers } from "@budibase/shared-core"
export * from "./utils" export * from "./utils"
export * from "./attachments" export * from "./attachments"
@ -162,10 +163,13 @@ export async function inputProcessing(
if (attachment?.url) { if (attachment?.url) {
delete clonedRow[key].url delete clonedRow[key].url
} }
} else if (field.type === FieldType.BB_REFERENCE && value) { } else if (
clonedRow[key] = await processInputBBReferences(value, field.subtype) field.type === FieldType.BB_REFERENCE_SINGLE ||
} else if (field.type === FieldType.BB_REFERENCE_SINGLE && value) { helpers.schema.isDeprecatedSingleUserColumn(field)
) {
clonedRow[key] = await processInputBBReference(value, field.subtype) clonedRow[key] = await processInputBBReference(value, field.subtype)
} else if (field.type === FieldType.BB_REFERENCE) {
clonedRow[key] = await processInputBBReferences(value, field.subtype)
} }
} }