Fixes
This commit is contained in:
parent
91332ce411
commit
e451e99f6b
|
@ -324,19 +324,22 @@ describe.each([
|
||||||
name: "deprecated_single_user",
|
name: "deprecated_single_user",
|
||||||
type: FieldType.BB_REFERENCE,
|
type: FieldType.BB_REFERENCE,
|
||||||
subtype: BBReferenceFieldSubType.USER,
|
subtype: BBReferenceFieldSubType.USER,
|
||||||
constraints: {
|
|
||||||
type: "array",
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
multi_user: {
|
multi_user: {
|
||||||
name: "multi_user",
|
name: "multi_user",
|
||||||
type: FieldType.BB_REFERENCE,
|
type: FieldType.BB_REFERENCE,
|
||||||
subtype: BBReferenceFieldSubType.USER,
|
subtype: BBReferenceFieldSubType.USER,
|
||||||
|
constraints: {
|
||||||
|
type: "array",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
deprecated_multi_user: {
|
deprecated_multi_user: {
|
||||||
name: "deprecated_multi_user",
|
name: "deprecated_multi_user",
|
||||||
type: FieldType.BB_REFERENCE,
|
type: FieldType.BB_REFERENCE,
|
||||||
subtype: BBReferenceFieldSubType.USERS,
|
subtype: BBReferenceFieldSubType.USERS,
|
||||||
|
constraints: {
|
||||||
|
type: "array",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
await createRows(rows(config.getUser()))
|
await createRows(rows(config.getUser()))
|
||||||
|
|
|
@ -9,10 +9,11 @@ import {
|
||||||
SearchFilterOperator,
|
SearchFilterOperator,
|
||||||
SortDirection,
|
SortDirection,
|
||||||
SortType,
|
SortType,
|
||||||
|
FieldConstraints,
|
||||||
} from "@budibase/types"
|
} from "@budibase/types"
|
||||||
import dayjs from "dayjs"
|
import dayjs from "dayjs"
|
||||||
import { OperatorOptions, SqlNumberTypeRangeMap } from "./constants"
|
import { OperatorOptions, SqlNumberTypeRangeMap } from "./constants"
|
||||||
import { deepGet } from "./helpers"
|
import { deepGet, schema } from "./helpers"
|
||||||
|
|
||||||
const HBS_REGEX = /{{([^{].*?)}}/g
|
const HBS_REGEX = /{{([^{].*?)}}/g
|
||||||
|
|
||||||
|
@ -24,6 +25,7 @@ export const getValidOperatorsForType = (
|
||||||
type: FieldType
|
type: FieldType
|
||||||
subtype?: BBReferenceFieldSubType
|
subtype?: BBReferenceFieldSubType
|
||||||
formulaType?: FormulaType
|
formulaType?: FormulaType
|
||||||
|
constraints?: FieldConstraints
|
||||||
},
|
},
|
||||||
field?: string,
|
field?: string,
|
||||||
datasource?: Datasource & { tableId: any }
|
datasource?: Datasource & { tableId: any }
|
||||||
|
@ -68,7 +70,10 @@ export const getValidOperatorsForType = (
|
||||||
ops = numOps
|
ops = numOps
|
||||||
} else if (type === FieldType.FORMULA && formulaType === FormulaType.STATIC) {
|
} else if (type === FieldType.FORMULA && formulaType === FormulaType.STATIC) {
|
||||||
ops = stringOps.concat([Op.MoreThan, Op.LessThan])
|
ops = stringOps.concat([Op.MoreThan, Op.LessThan])
|
||||||
} else if (type === FieldType.BB_REFERENCE_SINGLE) {
|
} else if (
|
||||||
|
type === FieldType.BB_REFERENCE_SINGLE ||
|
||||||
|
schema.isDeprecatedSingleUserColumn(fieldType)
|
||||||
|
) {
|
||||||
ops = [Op.Equals, Op.NotEquals, Op.Empty, Op.NotEmpty, Op.In]
|
ops = [Op.Equals, Op.NotEquals, Op.Empty, Op.NotEmpty, Op.In]
|
||||||
} else if (type === FieldType.BB_REFERENCE) {
|
} else if (type === FieldType.BB_REFERENCE) {
|
||||||
ops = [Op.Contains, Op.NotContains, Op.ContainsAny, Op.Empty, Op.NotEmpty]
|
ops = [Op.Contains, Op.NotContains, Op.ContainsAny, Op.Empty, Op.NotEmpty]
|
||||||
|
|
|
@ -4,7 +4,9 @@ import {
|
||||||
FieldType,
|
FieldType,
|
||||||
} from "@budibase/types"
|
} from "@budibase/types"
|
||||||
|
|
||||||
export function isDeprecatedSingleUserColumn(schema: FieldSchema) {
|
export function isDeprecatedSingleUserColumn(
|
||||||
|
schema: Pick<FieldSchema, "type" | "subtype" | "constraints">
|
||||||
|
) {
|
||||||
const result =
|
const result =
|
||||||
schema.type === FieldType.BB_REFERENCE &&
|
schema.type === FieldType.BB_REFERENCE &&
|
||||||
schema.subtype === BBReferenceFieldSubType.USER &&
|
schema.subtype === BBReferenceFieldSubType.USER &&
|
||||||
|
|
Loading…
Reference in New Issue