fix: query result formatting
This commit is contained in:
parent
d6d8280a36
commit
a79a5a21e7
1 changed files with 1 additions and 9 deletions
|
|
@ -19,15 +19,7 @@ function createCashboxBatch (rec) {
|
|||
function getBatches () {
|
||||
const sql = `SELECT cb.id, cb.device_id, cb.created, cb.operation_type, cb.bill_count_override, cb.performed_by,
|
||||
json_agg(b.*) AS bills FROM cashbox_batches cb LEFT JOIN bills b ON cb.id=b.cashbox_batch_id GROUP BY cb.id`
|
||||
return db.any(sql).then(res => _.map(it => ({
|
||||
id: it.id,
|
||||
deviceId: it.device_id,
|
||||
created: it.created,
|
||||
operationType: it.operation_type,
|
||||
billCountOverride: it.bill_count_override,
|
||||
performedBy: it.performed_by,
|
||||
bills: it.bills
|
||||
}), res))
|
||||
return db.any(sql).then(res => _.map(it => _.mapKeys(ite => _.camelCase(ite), it), res))
|
||||
}
|
||||
|
||||
function editBatchById (id, performedBy) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue