Enable importing bbrefs as string csv

This commit is contained in:
Adria Navarro 2023-10-10 11:58:45 +02:00
parent 62c6631bc8
commit fd414dbe4b
4 changed files with 13 additions and 4 deletions

View File

@ -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)

View File

@ -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
}

View File

@ -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

View File

@ -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
}