Feat: user compliance saving to DB
This commit is contained in:
parent
204e421b3d
commit
2a9e8dadba
7 changed files with 79 additions and 29 deletions
|
|
@ -115,12 +115,22 @@ async function updateCustomer (id, data, userToken) {
|
|||
|
||||
const sql = Pgp.helpers.update(updateData, _.keys(updateData), 'customers') +
|
||||
' where id=$1'
|
||||
invalidateCustomerNotifications(id, formattedData)
|
||||
|
||||
await db.none(sql, [id])
|
||||
|
||||
return getCustomerById(id)
|
||||
}
|
||||
|
||||
const invalidateCustomerNotifications = (id, data) => {
|
||||
let detail = '';
|
||||
if(data.authorized_override === 'verified') {
|
||||
detail = `BLOCKED_${id}`
|
||||
}
|
||||
const sql = `UPDATE notifications SET valid = 'f', read = 't' WHERE valid = 't' AND detail = $1`
|
||||
return db.none(sql, [detail])
|
||||
}
|
||||
|
||||
/**
|
||||
* Get customer by id
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue