Add status field in customers.batch
This commit is contained in:
parent
0f5dfaa513
commit
e347ddc608
2 changed files with 45 additions and 21 deletions
|
|
@ -39,11 +39,30 @@ function getDailyVolume (id) {
|
|||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Query all customers
|
||||
*
|
||||
* Add status as computed column,
|
||||
* which will indicate the name of the latest
|
||||
* compliance verfication completed by user.
|
||||
*
|
||||
* @returns {array} Array of customers populated with status field
|
||||
*/
|
||||
function batch () {
|
||||
const sql = `select * from customers
|
||||
const sql = `select
|
||||
CASE GREATEST(
|
||||
phone_at,
|
||||
id_card_at,
|
||||
front_facing_cam_at,
|
||||
id_card_image_at
|
||||
)
|
||||
WHEN phone_at THEN 'Phone'
|
||||
WHEN id_card_at THEN 'ID card'
|
||||
WHEN front_facing_cam_at THEN 'Front facing camera'
|
||||
WHEN id_card_image_at THEN 'ID card image'
|
||||
END AS status, * from customers
|
||||
where id != $1
|
||||
order by created desc limit $2`
|
||||
return db.any(sql, [ anonymous.uuid, NUM_RESULTS ])
|
||||
}
|
||||
|
||||
module.exports = { add, get, batch, getById }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue