From 04f22d6a814dd7cf7cc1ea0e3aee3eab1e5d2165 Mon Sep 17 00:00:00 2001 From: Nikola Ubavic <53820106+ubavic@users.noreply.github.com> Date: Thu, 7 Oct 2021 07:03:29 +0200 Subject: [PATCH] style: capitalize SQL keywords --- lib/customers.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/customers.js b/lib/customers.js index 0d1f4efb..c21784d2 100644 --- a/lib/customers.js +++ b/lib/customers.js @@ -481,15 +481,15 @@ function getCustomersList (phone = null, name = null, address = null, id = null) fiat_code AS last_tx_fiat_code, tx_class AS last_tx_class FROM ( SELECT c.id, c.authorized_override, - greatest(0, date_part('day', c.suspended_until - now())) AS days_suspended, - c.suspended_until > now() AS is_suspended, + greatest(0, date_part('day', c.suspended_until - NOW())) AS days_suspended, + c.suspended_until > NOW() AS is_suspended, c.front_camera_path, c.front_camera_override, c.phone, c.sms_override, c.id_card_data, c.id_card_data_override, c.id_card_data_expiration, c.id_card_photo_path, c.id_card_photo_override, c.us_ssn, c.us_ssn_override, c.sanctions, c.sanctions_at, c.sanctions_override, t.tx_class, t.fiat, t.fiat_code, t.created, - row_number() OVER (partition by c.id order by t.created desc) AS rn, - coalesce(sum(case when error_code is null or error_code not in ($1^) then t.fiat else 0 end) over (partition by c.id), 0) as total_spent, - sum(CASE WHEN t.id IS NOT NULL THEN 1 ELSE 0 END) OVER (partition by c.id) AS total_txs + ROW_NUMBER() OVER (PARTITION BY c.id ORDER BY t.created desc) AS rn, + COALESCE(SUM(CASE WHEN error_code IS NULL OR error_code NOT IN ($1^) THEN t.fiat ELSE 0 END) OVER (PARTITION BY c.id), 0) AS total_spent, + SUM(CASE WHEN t.id IS NOT NULL THEN 1 ELSE 0 END) OVER (PARTITION BY c.id) AS total_txs FROM customers c LEFT OUTER JOIN ( SELECT 'cashIn' AS tx_class, id, fiat, fiat_code, created, customer_id, error_code FROM cash_in_txs WHERE send_confirmed = true UNION @@ -498,7 +498,7 @@ function getCustomersList (phone = null, name = null, address = null, id = null) WHERE c.id != $2 ) AS cl WHERE rn = 1 AND ($4 IS NULL OR phone = $4) - AND ($5 IS NULL OR concat(id_card_data::json->>'firstName', ' ', id_card_data::json->>'lastName') = $5 OR id_card_data::json->>'firstName' = $5 OR id_card_data::json->>'lastName' = $5) + AND ($5 IS NULL OR CONCAT(id_card_data::json->>'firstName', ' ', id_card_data::json->>'lastName') = $5 OR id_card_data::json->>'firstName' = $5 OR id_card_data::json->>'lastName' = $5) AND ($6 IS NULL OR id_card_data::json->>'address' = $6) AND ($7 IS NULL OR id_card_data::json->>'documentNumber' = $7) limit $3`