style: added spec styles fix: fixed font color on search input style: added box-shadow to the search component feat: added local search functionality to the search component feat: integrated search component into the transactions page feat: allow multiple filter selection on the search component fix: let the user select only one filter for each type feat: added chips for the selected filters on the transactions page feat: added the remove function on the filter chips style: styled items according to spec refactor: simplified search component (moved logic to the outside) feat: added transaction filters to the gql query feat: added a 'clear all filters' button feat: added a filters query feat: added a gql query for the transaction filters fix: fixed the transactions gql query so it haves the same options as the transaction filters feat: added a 'loading' feature to the search box (shown while loading the filters) fix: fetch transactions and filters separately in the transactions page fix: style export fix: packages fix: transaction conflicts
30 lines
1.8 KiB
JavaScript
30 lines
1.8 KiB
JavaScript
const db = require('../db')
|
|
const cashInTx = require('../cash-in/cash-in-tx')
|
|
const { CASH_OUT_TRANSACTION_STATES } = require('../cash-out/cash-out-helper')
|
|
|
|
function transaction() {
|
|
const sql = `select distinct * from (
|
|
select 'type' as type, 'Cash In' as value union
|
|
select 'type' as type, 'Cash Out' as value union
|
|
select 'machine' as type, name as value from devices d inner join cash_in_txs t on d.device_id = t.device_id union
|
|
select 'machine' as type, name as value from devices d inner join cash_out_txs t on d.device_id = t.device_id union
|
|
select 'customer' as type, concat(id_card_data::json->>'firstName', ' ', id_card_data::json->>'lastName') as value
|
|
from customers c inner join cash_in_txs t on c.id = t.customer_id
|
|
where c.id_card_data::json->>'firstName' is not null or c.id_card_data::json->>'lastName' is not null union
|
|
select 'customer' as type, concat(id_card_data::json->>'firstName', ' ', id_card_data::json->>'lastName') as value
|
|
from customers c inner join cash_out_txs t on c.id = t.customer_id
|
|
where c.id_card_data::json->>'firstName' is not null or c.id_card_data::json->>'lastName' is not null union
|
|
select 'fiat' as type, fiat_code as value from cash_in_txs union
|
|
select 'fiat' as type, fiat_code as value from cash_out_txs union
|
|
select 'crypto' as type, crypto_code as value from cash_in_txs union
|
|
select 'crypto' as type, crypto_code as value from cash_out_txs union
|
|
select 'address' as type, to_address as value from cash_in_txs union
|
|
select 'address' as type, to_address as value from cash_in_txs union
|
|
select 'status' as type, ${cashInTx.TRANSACTION_STATES} as value from cash_in_txs union
|
|
select 'status' as type, ${CASH_OUT_TRANSACTION_STATES} as value from cash_out_txs
|
|
) f`
|
|
|
|
return db.any(sql)
|
|
}
|
|
|
|
module.exports = { transaction }
|