Fix get
This commit is contained in:
parent
75609b2a9b
commit
4169842018
|
@ -57,7 +57,9 @@ export async function patch(ctx: UserCtx<PatchRowRequest, PatchRowResponse>) {
|
||||||
throw { validation: validateResult.errors }
|
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, {
|
const response = await handleRequest(Operation.UPDATE, tableId, {
|
||||||
id: breakRowIdField(_id),
|
id: breakRowIdField(_id),
|
||||||
|
@ -67,7 +69,9 @@ export async function patch(ctx: UserCtx<PatchRowRequest, PatchRowResponse>) {
|
||||||
// The id might have been changed, so the refetching would fail. Recalculating the id just in case
|
// The id might have been changed, so the refetching would fail. Recalculating the id just in case
|
||||||
const updatedId =
|
const updatedId =
|
||||||
generateIdForRow({ ...beforeRow, ...dataToUpdate }, table) || _id
|
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([
|
const [enrichedRow, oldRow] = await Promise.all([
|
||||||
outputProcessing(table, row, {
|
outputProcessing(table, row, {
|
||||||
|
|
|
@ -9,7 +9,7 @@ import {
|
||||||
import cloneDeep from "lodash/fp/cloneDeep"
|
import cloneDeep from "lodash/fp/cloneDeep"
|
||||||
import isEqual from "lodash/fp/isEqual"
|
import isEqual from "lodash/fp/isEqual"
|
||||||
|
|
||||||
async function getRow(
|
export async function getRow(
|
||||||
tableId: string,
|
tableId: string,
|
||||||
rowId: string,
|
rowId: string,
|
||||||
opts?: { relationships?: boolean }
|
opts?: { relationships?: boolean }
|
||||||
|
|
Loading…
Reference in New Issue