1
0
Fork 0
mirror of synced 2024-07-04 22:11:23 +12:00

Merge branch 'master' into fix/11972-external-relationship-formulas

This commit is contained in:
Michael Drury 2023-11-07 18:35:43 +00:00 committed by GitHub
commit 18c417f02f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 31 additions and 11 deletions

View file

@ -1,5 +1,5 @@
{
"version": "2.13.2",
"version": "2.13.3",
"npmClient": "yarn",
"packages": [
"packages/*"

@ -1 +1 @@
Subproject commit 3820c0c93a3e448e10a60a9feb5396844b537ca8
Subproject commit ad9a0085bee0c4f3184acd86cadd872ea9917e88

View file

@ -254,7 +254,7 @@ export const exportRows = async (
const format = ctx.query.format
const { rows, columns, query } = ctx.request.body
const { rows, columns, query, sort, sortOrder } = ctx.request.body
if (typeof format !== "string" || !exporters.isFormat(format)) {
ctx.throw(
400,
@ -272,6 +272,8 @@ export const exportRows = async (
rowIds: rows,
columns,
query,
sort,
sortOrder,
})
ctx.attachment(fileName)
return apiFileReturn(content)

View file

@ -1,4 +1,10 @@
import { Row, SearchFilters, SearchParams } from "@budibase/types"
import {
Row,
SearchFilters,
SearchParams,
SortOrder,
SortType,
} from "@budibase/types"
import { isExternalTableID } from "../../../integrations/utils"
import * as internal from "./search/internal"
import * as external from "./search/external"
@ -32,6 +38,8 @@ export interface ExportRowsParams {
rowIds?: string[]
columns?: string[]
query?: SearchFilters
sort?: string
sortOrder?: SortOrder
}
export interface ExportRowsResult {

View file

@ -101,12 +101,12 @@ export async function search(options: SearchParams) {
export async function exportRows(
options: ExportRowsParams
): Promise<ExportRowsResult> {
const { tableId, format, columns, rowIds } = options
const { tableId, format, columns, rowIds, query, sort, sortOrder } = options
const { datasourceId, tableName } = breakExternalTableId(tableId)
let query: SearchFilters = {}
let requestQuery: SearchFilters = {}
if (rowIds?.length) {
query = {
requestQuery = {
oneOf: {
_id: rowIds.map((row: string) => {
const ids = JSON.parse(
@ -122,6 +122,8 @@ export async function exportRows(
}),
},
}
} else {
requestQuery = query || {}
}
const datasource = await sdk.datasources.get(datasourceId!)
@ -129,7 +131,7 @@ export async function exportRows(
throw new HTTPError("Datasource has not been configured for plus API.", 400)
}
let result = await search({ tableId, query })
let result = await search({ tableId, query: requestQuery, sort, sortOrder })
let rows: Row[] = []
// Filter data to only specified columns if required

View file

@ -84,7 +84,7 @@ export async function search(options: SearchParams) {
export async function exportRows(
options: ExportRowsParams
): Promise<ExportRowsResult> {
const { tableId, format, rowIds, columns, query } = options
const { tableId, format, rowIds, columns, query, sort, sortOrder } = options
const db = context.getAppDB()
const table = await sdk.tables.getTable(tableId)
@ -99,7 +99,12 @@ export async function exportRows(
result = await outputProcessing(table, response)
} else if (query) {
let searchResponse = await search({ tableId, query })
let searchResponse = await search({
tableId,
query,
sort,
sortOrder,
})
result = searchResponse.rows
}

View file

@ -1,5 +1,6 @@
import { SearchFilters, SearchParams } from "../../../sdk"
import { Row } from "../../../documents"
import { SortOrder } from "../../../api"
import { ReadStream } from "fs"
export interface SaveRowRequest extends Row {}
@ -34,6 +35,8 @@ export interface ExportRowsRequest {
rows: string[]
columns?: string[]
query?: SearchFilters
sort?: string
sortOrder?: SortOrder
}
export type ExportRowsResponse = ReadStream

View file

@ -1,7 +1,7 @@
## Description
_Describe the problem or feature in addition to a link to the relevant github issues._
### Addresses:
## Addresses
- `<Enter the Link to the issue(s) this PR addresses>`
- ...more if required