1
0
Fork 0
mirror of synced 2024-07-03 13:30:46 +12:00
budibase/packages/server/src/api/controllers/public/rows.js

37 lines
728 B
JavaScript
Raw Normal View History

const rowController = require("../row")
// makes sure that the user doesn't need to pass in the type, tableId or _id params for
// the call to be correct
function fixRow(row, params) {
if (!params || !row) {
return row
}
if (params.rowId) {
row._id = params.rowId
}
if (params.tableId) {
row.tableId = params.tableId
}
if (!row.type) {
row.type = "row"
}
return row
}
exports.search = async ctx => {
await rowController.search(ctx)
console.log(ctx.body)
2022-02-18 07:58:09 +13:00
}
exports.create = ctx => {
ctx.request.body = fixRow(ctx.request.body, ctx.params)
2022-02-18 07:58:09 +13:00
}
exports.read = () => {}
2022-02-18 07:58:09 +13:00
exports.update = async ctx => {
ctx.request.body = fixRow(ctx.request.body, ctx.params)
2022-02-18 07:58:09 +13:00
}
exports.delete = () => {}