From 3b01f404dd500033ca71a23dae04557ac87b2283 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Wed, 9 Oct 2024 13:49:24 +0200 Subject: [PATCH] Fix imports --- packages/server/src/api/controllers/table/index.ts | 6 +++--- packages/server/src/api/controllers/table/internal.ts | 3 --- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/server/src/api/controllers/table/index.ts b/packages/server/src/api/controllers/table/index.ts index 0e44548d99..404f82e57c 100644 --- a/packages/server/src/api/controllers/table/index.ts +++ b/packages/server/src/api/controllers/table/index.ts @@ -102,8 +102,8 @@ export async function find(ctx: UserCtx) { export async function save(ctx: UserCtx) { 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) { 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 { diff --git a/packages/server/src/api/controllers/table/internal.ts b/packages/server/src/api/controllers/table/internal.ts index 983f578bbc..40ce5e279d 100644 --- a/packages/server/src/api/controllers/table/internal.ts +++ b/packages/server/src/api/controllers/table/internal.ts @@ -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