Fix prefixes for SQS
This commit is contained in:
parent
1cd3347262
commit
c845db966f
|
@ -135,20 +135,36 @@ function cleanupFilters(
|
|||
allTables.some(table => table.schema[key])
|
||||
|
||||
const splitter = new dataFilters.ColumnSplitter(allTables)
|
||||
for (const filter of Object.values(filters)) {
|
||||
for (const key of Object.keys(filter)) {
|
||||
const { numberPrefix, relationshipPrefix, column } = splitter.run(key)
|
||||
if (keyInAnyTable(column)) {
|
||||
filter[
|
||||
`${numberPrefix || ""}${relationshipPrefix || ""}${mapToUserColumn(
|
||||
column
|
||||
)}`
|
||||
] = filter[key]
|
||||
delete filter[key]
|
||||
|
||||
const prefixFilters = (filters: SearchFilters) => {
|
||||
for (const filterKey of Object.keys(filters) as (keyof SearchFilters)[]) {
|
||||
if (
|
||||
filterKey === LogicalOperator.AND ||
|
||||
filterKey === LogicalOperator.OR
|
||||
) {
|
||||
for (const condition of filters[filterKey]!.conditions) {
|
||||
prefixFilters(condition)
|
||||
}
|
||||
} else {
|
||||
const filter = filters[filterKey]!
|
||||
if (typeof filter !== "object") {
|
||||
continue
|
||||
}
|
||||
for (const key of Object.keys(filter)) {
|
||||
const { numberPrefix, relationshipPrefix, column } = splitter.run(key)
|
||||
if (keyInAnyTable(column)) {
|
||||
filter[
|
||||
`${numberPrefix || ""}${
|
||||
relationshipPrefix || ""
|
||||
}${mapToUserColumn(column)}`
|
||||
] = filter[key]
|
||||
delete filter[key]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
prefixFilters(filters)
|
||||
return filters
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue