Fix imports

This commit is contained in:
Adria Navarro 2024-10-09 13:49:24 +02:00
parent 761d48f4d5
commit 3b01f404dd
2 changed files with 3 additions and 6 deletions

View File

@ -102,8 +102,8 @@ export async function find(ctx: UserCtx<void, TableResponse>) {
export async function save(ctx: UserCtx<SaveTableRequest, SaveTableResponse>) {
const appId = ctx.appId
const table = ctx.request.body
const isImport = table.rows
const { rows, ...table } = ctx.request.body
const isImport = rows
const renaming = ctx.request.body._rename
const isCreate = !table._id
@ -112,7 +112,7 @@ export async function save(ctx: UserCtx<SaveTableRequest, SaveTableResponse>) {
let savedTable: Table
if (isCreate) {
savedTable = await sdk.tables.create(table)
savedTable = await sdk.tables.create(table, rows, ctx.user._id)
savedTable = await sdk.tables.enrichViewSchemas(savedTable)
await events.table.created(savedTable)
} else {

View File

@ -25,8 +25,6 @@ export async function updateTable(
sourceType: rest.sourceType || TableSourceType.INTERNAL,
}
const isImport = !!rows
if (!tableToSave.views) {
tableToSave.views = {}
}
@ -37,7 +35,6 @@ export async function updateTable(
rowsToImport: rows,
tableId: ctx.request.body._id,
renaming,
isImport,
})
return table