Move constants to types
This commit is contained in:
parent
60dc6f2138
commit
9c6347f7fd
|
@ -15,6 +15,7 @@ import {
|
||||||
FieldSchema,
|
FieldSchema,
|
||||||
FieldType,
|
FieldType,
|
||||||
INTERNAL_TABLE_SOURCE_ID,
|
INTERNAL_TABLE_SOURCE_ID,
|
||||||
|
InternalSearchFilterOperator,
|
||||||
JsonFieldMetadata,
|
JsonFieldMetadata,
|
||||||
JsonTypes,
|
JsonTypes,
|
||||||
Operation,
|
Operation,
|
||||||
|
@ -170,8 +171,6 @@ function convertBooleans(query: SqlQuery | SqlQuery[]): SqlQuery | SqlQuery[] {
|
||||||
return query
|
return query
|
||||||
}
|
}
|
||||||
|
|
||||||
const COMPLEX_ID_OPERATOR = "_complexIdOperator"
|
|
||||||
|
|
||||||
class InternalBuilder {
|
class InternalBuilder {
|
||||||
private readonly client: string
|
private readonly client: string
|
||||||
|
|
||||||
|
@ -215,7 +214,7 @@ class InternalBuilder {
|
||||||
const updatedKey = dbCore.removeKeyNumbering(key)
|
const updatedKey = dbCore.removeKeyNumbering(key)
|
||||||
const isRelationshipField = updatedKey.includes(".")
|
const isRelationshipField = updatedKey.includes(".")
|
||||||
|
|
||||||
if (updatedKey === COMPLEX_ID_OPERATOR) {
|
if (updatedKey === InternalSearchFilterOperator.COMPLEX_ID_OPERATOR) {
|
||||||
const alias = getTableAlias(tableName)
|
const alias = getTableAlias(tableName)
|
||||||
fn(
|
fn(
|
||||||
value.id.map((x: string) => (alias ? `${alias}.${x}` : x)),
|
value.id.map((x: string) => (alias ? `${alias}.${x}` : x)),
|
||||||
|
@ -753,8 +752,6 @@ class InternalBuilder {
|
||||||
class SqlQueryBuilder extends SqlTableQueryBuilder {
|
class SqlQueryBuilder extends SqlTableQueryBuilder {
|
||||||
private readonly limit: number
|
private readonly limit: number
|
||||||
|
|
||||||
public static COMPLEX_ID_OPERATOR = COMPLEX_ID_OPERATOR
|
|
||||||
|
|
||||||
// pass through client to get flavour of SQL
|
// pass through client to get flavour of SQL
|
||||||
constructor(client: string, limit: number = BASE_LIMIT) {
|
constructor(client: string, limit: number = BASE_LIMIT) {
|
||||||
super(client)
|
super(client)
|
||||||
|
|
|
@ -7,6 +7,7 @@ import {
|
||||||
FieldType,
|
FieldType,
|
||||||
FilterType,
|
FilterType,
|
||||||
IncludeRelationship,
|
IncludeRelationship,
|
||||||
|
InternalSearchFilterOperator,
|
||||||
isManyToOne,
|
isManyToOne,
|
||||||
OneToManyRelationshipFieldMetadata,
|
OneToManyRelationshipFieldMetadata,
|
||||||
Operation,
|
Operation,
|
||||||
|
@ -40,7 +41,7 @@ import {
|
||||||
} from "../../../sdk/app/rows/utils"
|
} from "../../../sdk/app/rows/utils"
|
||||||
import { processObjectSync } from "@budibase/string-templates"
|
import { processObjectSync } from "@budibase/string-templates"
|
||||||
import { cloneDeep } from "lodash/fp"
|
import { cloneDeep } from "lodash/fp"
|
||||||
import { db as dbCore, sql } from "@budibase/backend-core"
|
import { db as dbCore } from "@budibase/backend-core"
|
||||||
import sdk from "../../../sdk"
|
import sdk from "../../../sdk"
|
||||||
import env from "../../../environment"
|
import env from "../../../environment"
|
||||||
import { makeExternalQuery } from "../../../integrations/base/query"
|
import { makeExternalQuery } from "../../../integrations/base/query"
|
||||||
|
@ -195,7 +196,7 @@ export class ExternalRequest<T extends Operation> {
|
||||||
if (primary) {
|
if (primary) {
|
||||||
const parts = breakRowIdField(operator[field])
|
const parts = breakRowIdField(operator[field])
|
||||||
if (primary.length > 1) {
|
if (primary.length > 1) {
|
||||||
operator[sql.Sql.COMPLEX_ID_OPERATOR] = {
|
operator[InternalSearchFilterOperator.COMPLEX_ID_OPERATOR] = {
|
||||||
id: primary,
|
id: primary,
|
||||||
values: parts[0],
|
values: parts[0],
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,10 @@ export enum SearchFilterOperator {
|
||||||
CONTAINS_ANY = "containsAny",
|
CONTAINS_ANY = "containsAny",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export enum InternalSearchFilterOperator {
|
||||||
|
COMPLEX_ID_OPERATOR = "_complexIdOperator",
|
||||||
|
}
|
||||||
|
|
||||||
export interface SearchFilters {
|
export interface SearchFilters {
|
||||||
allOr?: boolean
|
allOr?: boolean
|
||||||
// TODO: this is just around for now - we need a better way to do or/and
|
// TODO: this is just around for now - we need a better way to do or/and
|
||||||
|
|
Loading…
Reference in New Issue