1
0
Fork 0
mirror of synced 2024-07-13 02:05:54 +12:00

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": {
@ -180,4 +173,4 @@
"persons": "a",
"tasks": "b"
}
}
}

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": {
@ -106,4 +104,4 @@
"tasks": "b",
"products_tasks": "c"
}
}
}

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": {
@ -91,4 +89,4 @@
"primaryDisplay": "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": {
@ -199,4 +197,4 @@
"persons": "c",
"products_tasks": "d"
}
}
}

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)