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 { generator } from "@budibase/backend-core/tests"
import { events, context } from "@budibase/backend-core" 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 { checkBuilderEndpoint } from "./utilities/TestFunctions"
import * as setup from "./utilities" import * as setup from "./utilities"
const { basicTable } = setup.structures const { basicTable } = setup.structures
@ -47,7 +52,7 @@ describe("/tables", () => {
}) })
it("creates a table via data import", async () => { it("creates a table via data import", async () => {
const table = basicTable() const table: SaveTableRequest = basicTable()
table.rows = [{ name: "test-name", description: "test-desc" }] table.rows = [{ name: "test-name", description: "test-desc" }]
const res = await createTable(table) const res = await createTable(table)

View File

@ -162,6 +162,8 @@ export function parse(rows: Rows, schema: Schema): Rows {
parsedRow[columnName] = columnData parsedRow[columnName] = columnData
? new Date(columnData).toISOString() ? new Date(columnData).toISOString()
: columnData : columnData
} else if (columnType === FieldTypes.BB_REFERENCE) {
parsedRow[columnName] = columnData && parseCsvExport(columnData)
} else { } else {
parsedRow[columnName] = columnData parsedRow[columnName] = columnData
} }

View File

@ -1,4 +1,5 @@
import { import {
Row,
Table, Table,
TableRequest, TableRequest,
TableSchema, TableSchema,
@ -18,6 +19,8 @@ export interface TableResponse extends Table {
export type FetchTablesResponse = TableResponse[] export type FetchTablesResponse = TableResponse[]
export interface SaveTableRequest extends TableRequest {} export interface SaveTableRequest extends TableRequest {
rows?: Row[]
}
export type SaveTableResponse = Table export type SaveTableResponse = Table

View File

@ -15,7 +15,6 @@ export interface Table extends Document {
constrained?: string[] constrained?: string[]
sql?: boolean sql?: boolean
indexes?: { [key: string]: any } indexes?: { [key: string]: any }
rows?: { [key: string]: any }
created?: boolean created?: boolean
rowHeight?: number rowHeight?: number
} }