Test updated

This commit is contained in:
Adria Navarro 2024-08-29 12:21:48 +02:00
parent d75f1debda
commit 275d358df9
3 changed files with 5 additions and 2 deletions

View File

@ -38,7 +38,7 @@ export async function handleRequest<T extends Operation>(
}
export async function patch(ctx: UserCtx<PatchRowRequest, PatchRowResponse>) {
const { tableId } = utils.getSourceId(ctx)
const { tableId, viewId } = utils.getSourceId(ctx)
const { _id, ...rowData } = ctx.request.body
const table = await sdk.tables.getTable(tableId)
@ -77,6 +77,7 @@ export async function patch(ctx: UserCtx<PatchRowRequest, PatchRowResponse>) {
outputProcessing(table, row, {
squash: true,
preserveLinks: true,
fromViewId: viewId,
}),
outputProcessing(table, beforeRow, {
squash: true,

View File

@ -23,7 +23,7 @@ import { getLinkedTableIDs } from "../../../db/linkedRows/linkUtils"
import { flatten } from "lodash"
export async function patch(ctx: UserCtx<PatchRowRequest, PatchRowResponse>) {
const { tableId } = utils.getSourceId(ctx)
const { tableId, viewId } = utils.getSourceId(ctx)
const inputs = ctx.request.body
const isUserTable = tableId === InternalTables.USER_METADATA
let oldRow
@ -90,6 +90,7 @@ export async function patch(ctx: UserCtx<PatchRowRequest, PatchRowResponse>) {
const result = await finaliseRow(table, row, {
oldTable: dbTable,
updateFormula: true,
fromViewId: viewId,
})
return { ...result, oldRow }

View File

@ -2619,6 +2619,7 @@ describe.each([
},
],
["from original saved row", (row: Row) => row],
["from updated row", (row: Row) => config.api.row.save(viewId, row)],
]
it.each(testScenarios)(