Fixing an inconsistency that was raised by a community member.

This commit is contained in:
mike12345567 2022-03-08 18:00:49 +00:00
parent b96c6218d6
commit a3a6aeb777
1 changed files with 4 additions and 4 deletions

View File

@ -33,11 +33,11 @@ exports.handleRequest = handleRequest
exports.patch = async ctx => { exports.patch = async ctx => {
const inputs = ctx.request.body const inputs = ctx.request.body
const tableId = ctx.params.tableId const tableId = ctx.params.tableId
const id = breakRowIdField(inputs._id) const id = inputs._id
// don't save the ID to db // don't save the ID to db
delete inputs._id delete inputs._id
return handleRequest(DataSourceOperation.UPDATE, tableId, { return handleRequest(DataSourceOperation.UPDATE, tableId, {
id, id: breakRowIdField(id),
row: inputs, row: inputs,
}) })
} }
@ -67,7 +67,7 @@ exports.find = async ctx => {
const id = ctx.params.rowId const id = ctx.params.rowId
const tableId = ctx.params.tableId const tableId = ctx.params.tableId
const response = await handleRequest(DataSourceOperation.READ, tableId, { const response = await handleRequest(DataSourceOperation.READ, tableId, {
id, id: breakRowIdField(id),
}) })
return response ? response[0] : response return response ? response[0] : response
} }
@ -76,7 +76,7 @@ exports.destroy = async ctx => {
const tableId = ctx.params.tableId const tableId = ctx.params.tableId
const id = ctx.request.body._id const id = ctx.request.body._id
const { row } = await handleRequest(DataSourceOperation.DELETE, tableId, { const { row } = await handleRequest(DataSourceOperation.DELETE, tableId, {
id, id: breakRowIdField(id),
}) })
return { response: { ok: true }, row } return { response: { ok: true }, row }
} }