Ensure that sort order is always lowercased.
This commit is contained in:
parent
59e9658a6a
commit
f3c82cbf38
|
@ -14,14 +14,10 @@ import {
|
||||||
EmptyFilterOption,
|
EmptyFilterOption,
|
||||||
SearchFilters,
|
SearchFilters,
|
||||||
Table,
|
Table,
|
||||||
|
SortOrder,
|
||||||
} from "@budibase/types"
|
} from "@budibase/types"
|
||||||
import { db as dbCore } from "@budibase/backend-core"
|
import { db as dbCore } from "@budibase/backend-core"
|
||||||
|
|
||||||
enum SortOrder {
|
|
||||||
ASCENDING = "ascending",
|
|
||||||
DESCENDING = "descending",
|
|
||||||
}
|
|
||||||
|
|
||||||
const SortOrderPretty = {
|
const SortOrderPretty = {
|
||||||
[SortOrder.ASCENDING]: "Ascending",
|
[SortOrder.ASCENDING]: "Ascending",
|
||||||
[SortOrder.DESCENDING]: "Descending",
|
[SortOrder.DESCENDING]: "Descending",
|
||||||
|
|
|
@ -70,11 +70,6 @@ export enum DatasourceAuthTypes {
|
||||||
GOOGLE = "google",
|
GOOGLE = "google",
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum SortDirection {
|
|
||||||
ASCENDING = "ASCENDING",
|
|
||||||
DESCENDING = "DESCENDING",
|
|
||||||
}
|
|
||||||
|
|
||||||
export const USERS_TABLE_SCHEMA: Table = {
|
export const USERS_TABLE_SCHEMA: Table = {
|
||||||
_id: "ta_users",
|
_id: "ta_users",
|
||||||
type: "table",
|
type: "table",
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
"filters": {},
|
"filters": {},
|
||||||
"sort": {
|
"sort": {
|
||||||
"firstname": {
|
"firstname": {
|
||||||
"direction": "ASCENDING"
|
"direction": "ascending"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"paginate": {
|
"paginate": {
|
||||||
|
@ -65,9 +65,7 @@
|
||||||
"table": {
|
"table": {
|
||||||
"type": "table",
|
"type": "table",
|
||||||
"_id": "datasource_plus_8066e56456784eb2a00129d31be5c3e7__persons",
|
"_id": "datasource_plus_8066e56456784eb2a00129d31be5c3e7__persons",
|
||||||
"primary": [
|
"primary": ["personid"],
|
||||||
"personid"
|
|
||||||
],
|
|
||||||
"name": "persons",
|
"name": "persons",
|
||||||
"schema": {
|
"schema": {
|
||||||
"year": {
|
"year": {
|
||||||
|
@ -122,12 +120,7 @@
|
||||||
"name": "type",
|
"name": "type",
|
||||||
"constraints": {
|
"constraints": {
|
||||||
"presence": false,
|
"presence": false,
|
||||||
"inclusion": [
|
"inclusion": ["support", "designer", "programmer", "qa"]
|
||||||
"support",
|
|
||||||
"designer",
|
|
||||||
"programmer",
|
|
||||||
"qa"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"city": {
|
"city": {
|
||||||
|
@ -180,4 +173,4 @@
|
||||||
"persons": "a",
|
"persons": "a",
|
||||||
"tasks": "b"
|
"tasks": "b"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
},
|
},
|
||||||
"sort": {
|
"sort": {
|
||||||
"productname": {
|
"productname": {
|
||||||
"direction": "ASCENDING"
|
"direction": "ascending"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"paginate": {
|
"paginate": {
|
||||||
|
@ -60,9 +60,7 @@
|
||||||
"table": {
|
"table": {
|
||||||
"type": "table",
|
"type": "table",
|
||||||
"_id": "datasource_plus_44a967caf37a435f84fe01cd6dfe8f81__products",
|
"_id": "datasource_plus_44a967caf37a435f84fe01cd6dfe8f81__products",
|
||||||
"primary": [
|
"primary": ["productid"],
|
||||||
"productid"
|
|
||||||
],
|
|
||||||
"name": "products",
|
"name": "products",
|
||||||
"schema": {
|
"schema": {
|
||||||
"productname": {
|
"productname": {
|
||||||
|
@ -106,4 +104,4 @@
|
||||||
"tasks": "b",
|
"tasks": "b",
|
||||||
"products_tasks": "c"
|
"products_tasks": "c"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
},
|
},
|
||||||
"sort": {
|
"sort": {
|
||||||
"productname": {
|
"productname": {
|
||||||
"direction": "ASCENDING"
|
"direction": "ascending"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"paginate": {
|
"paginate": {
|
||||||
|
@ -50,9 +50,7 @@
|
||||||
"table": {
|
"table": {
|
||||||
"type": "table",
|
"type": "table",
|
||||||
"_id": "datasource_plus_8066e56456784eb2a00129d31be5c3e7__products",
|
"_id": "datasource_plus_8066e56456784eb2a00129d31be5c3e7__products",
|
||||||
"primary": [
|
"primary": ["productid"],
|
||||||
"productid"
|
|
||||||
],
|
|
||||||
"name": "products",
|
"name": "products",
|
||||||
"schema": {
|
"schema": {
|
||||||
"productname": {
|
"productname": {
|
||||||
|
@ -91,4 +89,4 @@
|
||||||
"primaryDisplay": "productname"
|
"primaryDisplay": "productname"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
},
|
},
|
||||||
"sort": {
|
"sort": {
|
||||||
"taskname": {
|
"taskname": {
|
||||||
"direction": "ASCENDING"
|
"direction": "ascending"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"paginate": {
|
"paginate": {
|
||||||
|
@ -106,9 +106,7 @@
|
||||||
"table": {
|
"table": {
|
||||||
"type": "table",
|
"type": "table",
|
||||||
"_id": "datasource_plus_44a967caf37a435f84fe01cd6dfe8f81__tasks",
|
"_id": "datasource_plus_44a967caf37a435f84fe01cd6dfe8f81__tasks",
|
||||||
"primary": [
|
"primary": ["taskid"],
|
||||||
"taskid"
|
|
||||||
],
|
|
||||||
"name": "tasks",
|
"name": "tasks",
|
||||||
"schema": {
|
"schema": {
|
||||||
"executorid": {
|
"executorid": {
|
||||||
|
@ -199,4 +197,4 @@
|
||||||
"persons": "c",
|
"persons": "c",
|
||||||
"products_tasks": "d"
|
"products_tasks": "d"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import {
|
||||||
RowSearchParams,
|
RowSearchParams,
|
||||||
SearchFilters,
|
SearchFilters,
|
||||||
SearchResponse,
|
SearchResponse,
|
||||||
|
SortOrder,
|
||||||
} from "@budibase/types"
|
} from "@budibase/types"
|
||||||
import { isExternalTableID } from "../../../integrations/utils"
|
import { isExternalTableID } from "../../../integrations/utils"
|
||||||
import * as internal from "./search/internal"
|
import * as internal from "./search/internal"
|
||||||
|
@ -78,6 +79,10 @@ export async function search(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (options.sortOrder) {
|
||||||
|
options.sortOrder = options.sortOrder.toLowerCase() as SortOrder
|
||||||
|
}
|
||||||
|
|
||||||
const table = await sdk.tables.getTable(options.tableId)
|
const table = await sdk.tables.getTable(options.tableId)
|
||||||
options = searchInputMapping(table, options)
|
options = searchInputMapping(table, options)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue