refactor: use flag in graphql objects
This commit is contained in:
parent
4116069bd5
commit
f394606821
4 changed files with 14 additions and 10 deletions
|
|
@ -488,7 +488,7 @@ function getCustomersList () {
|
|||
*/
|
||||
function getCustomerById (id) {
|
||||
const sql = `select id, authorized_override, days_suspended, front_camera_path, front_camera_override,
|
||||
phone, name, sms_override, id_card_data, id_card_data_override, id_card_data_expiration,
|
||||
phone, sms_override, id_card_data, id_card_data_override, id_card_data_expiration,
|
||||
id_card_photo_path, id_card_photo_override, us_ssn, us_ssn_override, sanctions, sanctions_at,
|
||||
sanctions_override, total_txs, total_spent, created as last_active, fiat as last_tx_fiat,
|
||||
fiat_code as last_tx_fiat_code, tx_class as last_tx_class
|
||||
|
|
@ -496,7 +496,7 @@ function getCustomerById (id) {
|
|||
select c.id, c.authorized_override,
|
||||
greatest(0, date_part('day', c.suspended_until - now())) as days_suspended,
|
||||
c.front_camera_path, c.front_camera_override,
|
||||
c.phone, c.name, c.sms_override, c.id_card_data, c.id_card_data_override, c.id_card_data_expiration,
|
||||
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,
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ const machineEventsByIdBatch = require('../../postgresql_interface').machineEven
|
|||
const promoCodeManager = require('../../promo-codes')
|
||||
const notifierQueries = require('../../notifier/queries')
|
||||
const bills = require('../bills')
|
||||
const anonymous = require('../../constants').anonymousCustomer
|
||||
|
||||
const serverVersion = require('../../../package.json').version
|
||||
const transactions = require('../transactions')
|
||||
|
|
@ -86,7 +87,7 @@ const typeDefs = gql`
|
|||
frontCameraPath: String
|
||||
frontCameraOverride: String
|
||||
phone: String
|
||||
name: String
|
||||
isAnonymous: Boolean
|
||||
smsOverride: String
|
||||
idCardData: JSONObject
|
||||
idCardDataOverride: String
|
||||
|
|
@ -213,6 +214,7 @@ const typeDefs = gql`
|
|||
cashInFeeCrypto: String
|
||||
minimumTx: Float
|
||||
customerId: ID
|
||||
isAnonymous: Boolean
|
||||
txVersion: Int!
|
||||
termsAccepted: Boolean
|
||||
commissionPercentage: String
|
||||
|
|
@ -356,7 +358,11 @@ const resolvers = {
|
|||
JSONObject: GraphQLJSONObject,
|
||||
Date: GraphQLDateTime,
|
||||
Customer: {
|
||||
transactions: parent => transactionsLoader.load(parent.id)
|
||||
transactions: parent => transactionsLoader.load(parent.id),
|
||||
isAnonymous: parent => (parent.id === anonymous.uuid)
|
||||
},
|
||||
Transaction: {
|
||||
isAnonymous: parent => (parent.customerId === anonymous.uuid)
|
||||
},
|
||||
Machine: {
|
||||
latestEvent: parent => machineEventsLoader.load(parent.deviceId)
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ import {
|
|||
import { getFormattedPhone, getName } from './helper'
|
||||
|
||||
const useStyles = makeStyles(styles)
|
||||
const ANONYMOUS_USER_NAME = 'anonymous'
|
||||
|
||||
const GET_CUSTOMER = gql`
|
||||
query customer($customerId: ID!) {
|
||||
|
|
@ -38,7 +37,7 @@ const GET_CUSTOMER = gql`
|
|||
frontCameraPath
|
||||
frontCameraOverride
|
||||
phone
|
||||
name
|
||||
isAnonymous
|
||||
smsOverride
|
||||
idCardData
|
||||
idCardDataOverride
|
||||
|
|
@ -167,7 +166,7 @@ const CustomerProfile = memo(() => {
|
|||
locale={locale}
|
||||
setShowCompliance={() => setShowCompliance(!showCompliance)}
|
||||
/>
|
||||
{!loading && customerData.name !== ANONYMOUS_USER_NAME && (
|
||||
{!loading && !customerData.isAnonymous && (
|
||||
<div>
|
||||
<Label1 className={classes.actionLabel}>Actions</Label1>
|
||||
<ActionButton
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ import { getStatus } from './helper'
|
|||
const useStyles = makeStyles(mainStyles)
|
||||
|
||||
const NUM_LOG_RESULTS = 1000
|
||||
const ANONYMOUS_USER_NAME = 'anonymous'
|
||||
|
||||
const GET_TRANSACTIONS_CSV = gql`
|
||||
query transactions($limit: Int, $from: Date, $until: Date) {
|
||||
|
|
@ -59,6 +58,7 @@ const GET_TRANSACTIONS = gql`
|
|||
customerPhone
|
||||
discount
|
||||
customerId
|
||||
isAnonymous
|
||||
}
|
||||
}
|
||||
`
|
||||
|
|
@ -88,7 +88,6 @@ const Transactions = () => {
|
|||
if (tx.customerIdCardData) return formatCustomerName(tx.customerIdCardData)
|
||||
return tx.customerPhone
|
||||
}
|
||||
|
||||
const elements = [
|
||||
{
|
||||
header: '',
|
||||
|
|
@ -110,7 +109,7 @@ const Transactions = () => {
|
|||
view: it => (
|
||||
<div className={classes.flexWrapper}>
|
||||
<div className={classes.overflowTd}>{getCustomerDisplayName(it)}</div>
|
||||
{getCustomerDisplayName(it) !== ANONYMOUS_USER_NAME && (
|
||||
{!it.isAnonymous && (
|
||||
<div onClick={() => redirect(it.customerId)}>
|
||||
<CustomerLinkIcon className={classes.customerLinkIcon} />
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue