Clean multiple user checks to simplify
This commit is contained in:
parent
07dd0bc1ae
commit
02bfaa4378
|
@ -195,20 +195,8 @@
|
|||
return []
|
||||
}
|
||||
|
||||
let type = filter.type
|
||||
if (type === FieldType.BB_REFERENCE) {
|
||||
const fieldSchema = getSchema(filter)
|
||||
if (fieldSchema) {
|
||||
type = {
|
||||
type: fieldSchema.type,
|
||||
multiple:
|
||||
fieldSchema.relationshipType === RelationshipType.MANY_TO_MANY,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const operators = LuceneUtils.getValidOperatorsForType(
|
||||
type,
|
||||
filter.type,
|
||||
filter.field,
|
||||
datasource
|
||||
)
|
||||
|
|
|
@ -12,22 +12,12 @@ import { deepGet } from "./helpers"
|
|||
|
||||
const HBS_REGEX = /{{([^{].*?)}}/g
|
||||
|
||||
type RequestedFieldType =
|
||||
| Exclude<FieldType, FieldType.BB_REFERENCE>
|
||||
| { type: FieldType.BB_REFERENCE; multiple: boolean }
|
||||
|
||||
export function isFieldType(
|
||||
r: RequestedFieldType
|
||||
): r is Exclude<FieldType, FieldType.BB_REFERENCE> {
|
||||
return typeof r === "string" && Object.values(FieldType).includes(r)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the valid operator options for a certain data type
|
||||
* @param type the data type
|
||||
*/
|
||||
export const getValidOperatorsForType = (
|
||||
type: RequestedFieldType,
|
||||
type: FieldType,
|
||||
field: string,
|
||||
datasource: Datasource & { tableId: any } // TODO: is this table id ever populated?
|
||||
) => {
|
||||
|
@ -70,14 +60,9 @@ export const getValidOperatorsForType = (
|
|||
ops = numOps
|
||||
} else if (type === FieldType.FORMULA) {
|
||||
ops = stringOps.concat([Op.MoreThan, Op.LessThan])
|
||||
} else if (!isFieldType(type) && type.type === FieldType.BB_REFERENCE) {
|
||||
if (type.multiple) {
|
||||
// Temporally disabled
|
||||
ops = []
|
||||
} else {
|
||||
} else if (type === FieldType.BB_REFERENCE) {
|
||||
ops = [Op.Equals, Op.NotEquals, Op.Empty, Op.NotEmpty, Op.In]
|
||||
}
|
||||
}
|
||||
|
||||
// Only allow equal/not equal for _id in SQL tables
|
||||
const externalTable = datasource?.tableId?.includes("datasource_plus")
|
||||
|
|
Loading…
Reference in New Issue