From 41698420180a0984e8c97622cb25b6db9be62d76 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 23 Jul 2024 15:22:26 +0200 Subject: [PATCH] Fix get --- packages/server/src/api/controllers/row/external.ts | 8 ++++++-- packages/server/src/sdk/app/rows/external.ts | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/server/src/api/controllers/row/external.ts b/packages/server/src/api/controllers/row/external.ts index 18c88923e0..06013d230c 100644 --- a/packages/server/src/api/controllers/row/external.ts +++ b/packages/server/src/api/controllers/row/external.ts @@ -57,7 +57,9 @@ export async function patch(ctx: UserCtx) { throw { validation: validateResult.errors } } - const beforeRow = await sdk.rows.external.find(tableId, _id) + const beforeRow = await sdk.rows.external.getRow(tableId, _id, { + relationships: true, + }) const response = await handleRequest(Operation.UPDATE, tableId, { id: breakRowIdField(_id), @@ -67,7 +69,9 @@ export async function patch(ctx: UserCtx) { // The id might have been changed, so the refetching would fail. Recalculating the id just in case const updatedId = generateIdForRow({ ...beforeRow, ...dataToUpdate }, table) || _id - const row = await sdk.rows.external.find(tableId, updatedId) + const row = await sdk.rows.external.getRow(tableId, updatedId, { + relationships: true, + }) const [enrichedRow, oldRow] = await Promise.all([ outputProcessing(table, row, { diff --git a/packages/server/src/sdk/app/rows/external.ts b/packages/server/src/sdk/app/rows/external.ts index dc1e368f41..7cf28300ed 100644 --- a/packages/server/src/sdk/app/rows/external.ts +++ b/packages/server/src/sdk/app/rows/external.ts @@ -9,7 +9,7 @@ import { import cloneDeep from "lodash/fp/cloneDeep" import isEqual from "lodash/fp/isEqual" -async function getRow( +export async function getRow( tableId: string, rowId: string, opts?: { relationships?: boolean }