Chore: query formatting
This commit is contained in:
parent
c4666160ae
commit
8cb4b0bb97
1 changed files with 7 additions and 1 deletions
|
|
@ -2,7 +2,13 @@ const db = require('../db')
|
|||
|
||||
// Get all bills with device id
|
||||
const getBills = () => {
|
||||
return db.any(`SELECT d.device_id, b.fiat, b.created, d.cashbox FROM cash_in_txs INNER JOIN bills AS b ON b.cash_in_txs_id = cash_in_txs.id INNER JOIN devices as d ON d.device_id = cash_in_txs.device_id ORDER BY device_id, created DESC`)
|
||||
return db.any(`
|
||||
SELECT d.device_id, b.fiat, b.created, d.cashbox
|
||||
FROM cash_in_txs
|
||||
INNER JOIN bills AS b ON b.cash_in_txs_id = cash_in_txs.id
|
||||
INNER JOIN devices as d ON d.device_id = cash_in_txs.device_id
|
||||
ORDER BY device_id, created DESC`
|
||||
)
|
||||
.then(res => {
|
||||
return res.map(item => ({
|
||||
fiat: item.fiat,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue