chore: builded files and missing commit

This commit is contained in:
Taranto 2021-11-23 09:37:01 +00:00
parent 60e939a4b9
commit 01eb42e3cd
17 changed files with 56 additions and 17 deletions

View file

@ -19,8 +19,13 @@ function createCashboxBatch (deviceId, cashboxCount) {
}
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`
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 AS cb
LEFT JOIN bills AS b ON cb.id = b.cashbox_batch_id
GROUP BY cb.id
ORDER BY cb.created DESC
`
return db.any(sql).then(res => _.map(it => _.mapKeys(ite => _.camelCase(ite), it), res))
}