budibase/packages/shared-core/src/helpers/schema.ts

19 lines
467 B
TypeScript
Raw Normal View History

2024-05-09 12:28:44 +02:00
import {
BBReferenceFieldSubType,
FieldSchema,
FieldType,
} from "@budibase/types"
2024-05-13 12:13:57 +02:00
export function isDeprecatedSingleUserColumn(
schema: Pick<FieldSchema, "type" | "subtype" | "constraints">
2024-05-14 17:43:42 +02:00
): schema is {
type: FieldType.BB_REFERENCE
subtype: BBReferenceFieldSubType.USER
} {
2024-05-09 12:28:44 +02:00
const result =
schema.type === FieldType.BB_REFERENCE &&
schema.subtype === BBReferenceFieldSubType.USER &&
schema.constraints?.type !== "array"
return result
}