feat: sms data editable fields
This commit is contained in:
parent
5406a3cfdd
commit
62284a1d33
5 changed files with 71 additions and 11 deletions
|
|
@ -24,6 +24,7 @@ const operatorDataDir = _.get('operatorDataDir', options)
|
|||
const sms = require('./sms')
|
||||
const settingsLoader = require('./new-settings-loader')
|
||||
const logger = require('./logger')
|
||||
const consoleLogLevel = require('console-log-level')
|
||||
|
||||
const TX_PASSTHROUGH_ERROR_CODES = ['operatorCancel']
|
||||
|
||||
|
|
@ -121,7 +122,8 @@ async function updateCustomer (id, data, userToken) {
|
|||
'us_ssn_override',
|
||||
'sanctions_override',
|
||||
'front_camera_override',
|
||||
'suspended_until'
|
||||
'suspended_until',
|
||||
'subscriber_info_override'
|
||||
],
|
||||
_.mapKeys(_.snakeCase, data))
|
||||
|
||||
|
|
@ -164,11 +166,13 @@ function edit (id, data, userToken) {
|
|||
'id_card_photo',
|
||||
'us_ssn',
|
||||
'subscriber_info',
|
||||
'name'
|
||||
'name',
|
||||
'phone'
|
||||
]
|
||||
const filteredData = _.pick(defaults, _.mapKeys(_.snakeCase, _.omitBy(_.isNil, data)))
|
||||
if (_.isEmpty(filteredData)) return getCustomerById(id)
|
||||
const formattedData = enhanceEditedPhotos(enhanceEditedFields(filteredData, userToken))
|
||||
|
||||
const defaultDbData = {
|
||||
customer_id: id,
|
||||
created: new Date(),
|
||||
|
|
@ -688,16 +692,16 @@ function getCustomersList (phone = null, name = null, address = null, id = null)
|
|||
function getCustomerById (id) {
|
||||
const passableErrorCodes = _.map(Pgp.as.text, TX_PASSTHROUGH_ERROR_CODES).join(',')
|
||||
const sql = `SELECT id, authorized_override, days_suspended, is_suspended, front_camera_path, front_camera_at, front_camera_override,
|
||||
phone, sms_override, id_card_data_at, id_card_data, id_card_data_override, id_card_data_expiration,
|
||||
phone, phone_at, sms_override, id_card_data_at, id_card_data, id_card_data_override, id_card_data_expiration,
|
||||
id_card_photo_path, id_card_photo_at, id_card_photo_override, us_ssn_at, us_ssn, us_ssn_override, sanctions, sanctions_at,
|
||||
sanctions_override, total_txs, total_spent, LEAST(created, last_transaction) AS last_active, fiat AS last_tx_fiat,
|
||||
fiat_code AS last_tx_fiat_code, tx_class AS last_tx_class, subscriber_info, custom_fields, notes, is_test_customer
|
||||
fiat_code AS last_tx_fiat_code, tx_class AS last_tx_class, subscriber_info, subscriber_info_at, subscriber_info_override, custom_fields, notes, is_test_customer
|
||||
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,
|
||||
c.front_camera_path, c.front_camera_override, c.front_camera_at,
|
||||
c.phone, c.sms_override, c.id_card_data, c.id_card_data_at, c.id_card_data_override, c.id_card_data_expiration,
|
||||
c.phone, c.phone_at, c.sms_override, c.id_card_data, c.id_card_data_at, c.id_card_data_override, c.id_card_data_expiration,
|
||||
c.id_card_photo_path, c.id_card_photo_at, c.id_card_photo_override, c.us_ssn, c.us_ssn_at, c.us_ssn_override, c.sanctions,
|
||||
c.sanctions_at, c.sanctions_override, c.subscriber_info, c.is_test_customer, c.created, t.tx_class, t.fiat, t.fiat_code, t.created as last_transaction, cn.notes,
|
||||
row_number() OVER (PARTITION BY c.id ORDER BY t.created DESC) AS rn,
|
||||
|
|
@ -750,7 +754,8 @@ function selectLatestData (customerData, customerEditedData) {
|
|||
'id_card_photo',
|
||||
'us_ssn',
|
||||
'subscriber_info',
|
||||
'name'
|
||||
'name',
|
||||
'phone'
|
||||
]
|
||||
_.map(field => {
|
||||
let fieldName = field
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue