Fixing issue found with enriching rows in SQL - the system was assuming the array of entries contained a row ID that needed to be broken down.
This commit is contained in:
parent
531985c8da
commit
d06ab10c1d
|
@ -1,4 +1,5 @@
|
|||
import {
|
||||
FilterTypes,
|
||||
IncludeRelationships,
|
||||
Operation,
|
||||
PaginationJson,
|
||||
|
@ -118,8 +119,13 @@ module External {
|
|||
}
|
||||
// check the row and filters to make sure they aren't a key of some sort
|
||||
if (config.filters) {
|
||||
for (let filter of Object.values(config.filters)) {
|
||||
if (typeof filter !== "object" || Object.keys(filter).length === 0) {
|
||||
for (let [key, filter] of Object.entries(config.filters)) {
|
||||
// oneOf is an array, don't iterate it
|
||||
if (
|
||||
typeof filter !== "object" ||
|
||||
Object.keys(filter).length === 0 ||
|
||||
key === FilterTypes.ONE_OF
|
||||
) {
|
||||
continue
|
||||
}
|
||||
iterateObject(filter)
|
||||
|
|
|
@ -54,6 +54,17 @@ export enum IncludeRelationships {
|
|||
EXCLUDE = 0,
|
||||
}
|
||||
|
||||
export enum FilterTypes {
|
||||
STRING = "string",
|
||||
FUZZY = "fuzzy",
|
||||
RANGE = "range",
|
||||
EQUAL = "equal",
|
||||
NOT_EQUAL = "notEqual",
|
||||
EMPTY = "empty",
|
||||
NOT_EMPTY = "notEmpty",
|
||||
ONE_OF = "oneOf",
|
||||
}
|
||||
|
||||
export interface QueryDefinition {
|
||||
type: QueryTypes
|
||||
displayName?: string
|
||||
|
|
|
@ -93,7 +93,7 @@ class InternalBuilder {
|
|||
if (filters.oneOf) {
|
||||
iterate(filters.oneOf, (key, array) => {
|
||||
const fnc = allOr ? "orWhereIn" : "whereIn"
|
||||
query = query[fnc](key, array)
|
||||
query = query[fnc](key, Array.isArray(array) ? array : [array])
|
||||
})
|
||||
}
|
||||
if (filters.string) {
|
||||
|
|
Loading…
Reference in New Issue