Fix patch on external ds
This commit is contained in:
parent
81ca81222c
commit
d0fcb5d7e6
|
@ -56,14 +56,21 @@ export async function patch(ctx: UserCtx<PatchRowRequest, PatchRowResponse>) {
|
||||||
if (!validateResult.valid) {
|
if (!validateResult.valid) {
|
||||||
throw { validation: validateResult.errors }
|
throw { validation: validateResult.errors }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const table = await sdk.tables.getTable(tableId)
|
||||||
|
const { row: dataToUpdate } = await inputProcessing(
|
||||||
|
ctx.user?._id,
|
||||||
|
cloneDeep(table),
|
||||||
|
rowData
|
||||||
|
)
|
||||||
|
|
||||||
const response = await handleRequest(Operation.UPDATE, tableId, {
|
const response = await handleRequest(Operation.UPDATE, tableId, {
|
||||||
id: breakRowIdField(_id),
|
id: breakRowIdField(_id),
|
||||||
row: rowData,
|
row: dataToUpdate,
|
||||||
})
|
})
|
||||||
const row = await sdk.rows.external.getRow(tableId, _id, {
|
const row = await sdk.rows.external.getRow(tableId, _id, {
|
||||||
relationships: true,
|
relationships: true,
|
||||||
})
|
})
|
||||||
const table = await sdk.tables.getTable(tableId)
|
|
||||||
return {
|
return {
|
||||||
...response,
|
...response,
|
||||||
row,
|
row,
|
||||||
|
@ -107,9 +114,11 @@ export async function save(ctx: UserCtx) {
|
||||||
return {
|
return {
|
||||||
...response,
|
...response,
|
||||||
row,
|
row,
|
||||||
|
// row: await outputProcessing(table, row),
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return response
|
return response
|
||||||
|
// return outputProcessing(table, response)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
import { IncludeRelationship, Operation, Row } from "@budibase/types"
|
import { IncludeRelationship, Operation, Row } from "@budibase/types"
|
||||||
import { handleRequest } from "../../../api/controllers/row/external"
|
import { handleRequest } from "../../../api/controllers/row/external"
|
||||||
import { breakRowIdField } from "../../../integrations/utils"
|
import { breakRowIdField } from "../../../integrations/utils"
|
||||||
|
import { outputProcessing } from "../../../utilities/rowProcessor"
|
||||||
|
import sdk from "../../../sdk"
|
||||||
|
|
||||||
export async function getRow(
|
export async function getRow(
|
||||||
tableId: string,
|
tableId: string,
|
||||||
|
@ -13,5 +15,9 @@ export async function getRow(
|
||||||
? IncludeRelationship.INCLUDE
|
? IncludeRelationship.INCLUDE
|
||||||
: IncludeRelationship.EXCLUDE,
|
: IncludeRelationship.EXCLUDE,
|
||||||
})) as Row[]
|
})) as Row[]
|
||||||
return response ? response[0] : response
|
const row = response ? response[0] : response
|
||||||
|
|
||||||
|
const table = await sdk.tables.getTable(tableId)
|
||||||
|
const enrichedRow = await outputProcessing(table, row)
|
||||||
|
return enrichedRow
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue