Ensure that sort order is always lowercased.

This commit is contained in:
Sam Rose 2024-06-14 11:00:34 +01:00
parent 59e9658a6a
commit f3c82cbf38
No known key found for this signature in database
7 changed files with 19 additions and 36 deletions

View File

@ -14,14 +14,10 @@ import {
EmptyFilterOption,
SearchFilters,
Table,
SortOrder,
} from "@budibase/types"
import { db as dbCore } from "@budibase/backend-core"
enum SortOrder {
ASCENDING = "ascending",
DESCENDING = "descending",
}
const SortOrderPretty = {
[SortOrder.ASCENDING]: "Ascending",
[SortOrder.DESCENDING]: "Descending",

View File

@ -70,11 +70,6 @@ export enum DatasourceAuthTypes {
GOOGLE = "google",
}
export enum SortDirection {
ASCENDING = "ASCENDING",
DESCENDING = "DESCENDING",
}
export const USERS_TABLE_SCHEMA: Table = {
_id: "ta_users",
type: "table",

View File

@ -29,7 +29,7 @@
"filters": {},
"sort": {
"firstname": {
"direction": "ASCENDING"
"direction": "ascending"
}
},
"paginate": {
@ -65,9 +65,7 @@
"table": {
"type": "table",
"_id": "datasource_plus_8066e56456784eb2a00129d31be5c3e7__persons",
"primary": [
"personid"
],
"primary": ["personid"],
"name": "persons",
"schema": {
"year": {
@ -122,12 +120,7 @@
"name": "type",
"constraints": {
"presence": false,
"inclusion": [
"support",
"designer",
"programmer",
"qa"
]
"inclusion": ["support", "designer", "programmer", "qa"]
}
},
"city": {

View File

@ -30,7 +30,7 @@
},
"sort": {
"productname": {
"direction": "ASCENDING"
"direction": "ascending"
}
},
"paginate": {
@ -60,9 +60,7 @@
"table": {
"type": "table",
"_id": "datasource_plus_44a967caf37a435f84fe01cd6dfe8f81__products",
"primary": [
"productid"
],
"primary": ["productid"],
"name": "products",
"schema": {
"productname": {

View File

@ -23,7 +23,7 @@
},
"sort": {
"productname": {
"direction": "ASCENDING"
"direction": "ascending"
}
},
"paginate": {
@ -50,9 +50,7 @@
"table": {
"type": "table",
"_id": "datasource_plus_8066e56456784eb2a00129d31be5c3e7__products",
"primary": [
"productid"
],
"primary": ["productid"],
"name": "products",
"schema": {
"productname": {

View File

@ -56,7 +56,7 @@
},
"sort": {
"taskname": {
"direction": "ASCENDING"
"direction": "ascending"
}
},
"paginate": {
@ -106,9 +106,7 @@
"table": {
"type": "table",
"_id": "datasource_plus_44a967caf37a435f84fe01cd6dfe8f81__tasks",
"primary": [
"taskid"
],
"primary": ["taskid"],
"name": "tasks",
"schema": {
"executorid": {

View File

@ -4,6 +4,7 @@ import {
RowSearchParams,
SearchFilters,
SearchResponse,
SortOrder,
} from "@budibase/types"
import { isExternalTableID } from "../../../integrations/utils"
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)
options = searchInputMapping(table, options)