Enable importing bbrefs as string csv
This commit is contained in:
parent
62c6631bc8
commit
fd414dbe4b
|
@ -1,6 +1,11 @@
|
|||
import { generator } from "@budibase/backend-core/tests"
|
||||
import { events, context } from "@budibase/backend-core"
|
||||
import { FieldType, Table, ViewCalculation } from "@budibase/types"
|
||||
import {
|
||||
FieldType,
|
||||
SaveTableRequest,
|
||||
Table,
|
||||
ViewCalculation,
|
||||
} from "@budibase/types"
|
||||
import { checkBuilderEndpoint } from "./utilities/TestFunctions"
|
||||
import * as setup from "./utilities"
|
||||
const { basicTable } = setup.structures
|
||||
|
@ -47,7 +52,7 @@ describe("/tables", () => {
|
|||
})
|
||||
|
||||
it("creates a table via data import", async () => {
|
||||
const table = basicTable()
|
||||
const table: SaveTableRequest = basicTable()
|
||||
table.rows = [{ name: "test-name", description: "test-desc" }]
|
||||
|
||||
const res = await createTable(table)
|
||||
|
|
|
@ -162,6 +162,8 @@ export function parse(rows: Rows, schema: Schema): Rows {
|
|||
parsedRow[columnName] = columnData
|
||||
? new Date(columnData).toISOString()
|
||||
: columnData
|
||||
} else if (columnType === FieldTypes.BB_REFERENCE) {
|
||||
parsedRow[columnName] = columnData && parseCsvExport(columnData)
|
||||
} else {
|
||||
parsedRow[columnName] = columnData
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import {
|
||||
Row,
|
||||
Table,
|
||||
TableRequest,
|
||||
TableSchema,
|
||||
|
@ -18,6 +19,8 @@ export interface TableResponse extends Table {
|
|||
|
||||
export type FetchTablesResponse = TableResponse[]
|
||||
|
||||
export interface SaveTableRequest extends TableRequest {}
|
||||
export interface SaveTableRequest extends TableRequest {
|
||||
rows?: Row[]
|
||||
}
|
||||
|
||||
export type SaveTableResponse = Table
|
||||
|
|
|
@ -15,7 +15,6 @@ export interface Table extends Document {
|
|||
constrained?: string[]
|
||||
sql?: boolean
|
||||
indexes?: { [key: string]: any }
|
||||
rows?: { [key: string]: any }
|
||||
created?: boolean
|
||||
rowHeight?: number
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue