Test updated
This commit is contained in:
parent
d75f1debda
commit
275d358df9
|
@ -38,7 +38,7 @@ export async function handleRequest<T extends Operation>(
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function patch(ctx: UserCtx<PatchRowRequest, PatchRowResponse>) {
|
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 { _id, ...rowData } = ctx.request.body
|
||||||
const table = await sdk.tables.getTable(tableId)
|
const table = await sdk.tables.getTable(tableId)
|
||||||
|
@ -77,6 +77,7 @@ export async function patch(ctx: UserCtx<PatchRowRequest, PatchRowResponse>) {
|
||||||
outputProcessing(table, row, {
|
outputProcessing(table, row, {
|
||||||
squash: true,
|
squash: true,
|
||||||
preserveLinks: true,
|
preserveLinks: true,
|
||||||
|
fromViewId: viewId,
|
||||||
}),
|
}),
|
||||||
outputProcessing(table, beforeRow, {
|
outputProcessing(table, beforeRow, {
|
||||||
squash: true,
|
squash: true,
|
||||||
|
|
|
@ -23,7 +23,7 @@ import { getLinkedTableIDs } from "../../../db/linkedRows/linkUtils"
|
||||||
import { flatten } from "lodash"
|
import { flatten } from "lodash"
|
||||||
|
|
||||||
export async function patch(ctx: UserCtx<PatchRowRequest, PatchRowResponse>) {
|
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 inputs = ctx.request.body
|
||||||
const isUserTable = tableId === InternalTables.USER_METADATA
|
const isUserTable = tableId === InternalTables.USER_METADATA
|
||||||
let oldRow
|
let oldRow
|
||||||
|
@ -90,6 +90,7 @@ export async function patch(ctx: UserCtx<PatchRowRequest, PatchRowResponse>) {
|
||||||
const result = await finaliseRow(table, row, {
|
const result = await finaliseRow(table, row, {
|
||||||
oldTable: dbTable,
|
oldTable: dbTable,
|
||||||
updateFormula: true,
|
updateFormula: true,
|
||||||
|
fromViewId: viewId,
|
||||||
})
|
})
|
||||||
|
|
||||||
return { ...result, oldRow }
|
return { ...result, oldRow }
|
||||||
|
|
|
@ -2619,6 +2619,7 @@ describe.each([
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
["from original saved row", (row: Row) => row],
|
["from original saved row", (row: Row) => row],
|
||||||
|
["from updated row", (row: Row) => config.api.row.save(viewId, row)],
|
||||||
]
|
]
|
||||||
|
|
||||||
it.each(testScenarios)(
|
it.each(testScenarios)(
|
||||||
|
|
Loading…
Reference in New Issue