Merge pull request #1312 from siiky/fix/lam-548/gql-bugs-8.1
Server-machine GraphQL bugs
This commit is contained in:
commit
3d96e8321c
2 changed files with 25 additions and 10 deletions
|
|
@ -23,16 +23,18 @@ const speedtestFiles = [
|
|||
]
|
||||
|
||||
const addSmthInfo = (dstField, srcFields) => smth =>
|
||||
smth && smth.active ? _.set(dstField, _.pick(srcFields, smth)) : _.identity
|
||||
(smth && smth.active) ? _.set(dstField, _.pick(srcFields, smth)) : _.identity
|
||||
|
||||
const addOperatorInfo = addSmthInfo(
|
||||
'operatorInfo',
|
||||
['name', 'phone', 'email', 'website', 'companyNumber']
|
||||
)
|
||||
|
||||
const addReceiptInfo = addSmthInfo(
|
||||
'receiptInfo',
|
||||
[
|
||||
const addReceiptInfo = receiptInfo => ret => {
|
||||
if (!receiptInfo) return ret
|
||||
|
||||
const fields = [
|
||||
'paper',
|
||||
'sms',
|
||||
'operatorWebsite',
|
||||
'operatorEmail',
|
||||
|
|
@ -43,10 +45,22 @@ const addReceiptInfo = addSmthInfo(
|
|||
'exchangeRate',
|
||||
'addressQRCode',
|
||||
]
|
||||
)
|
||||
const defaults = _.fromPairs(_.map(field => [field, false], fields))
|
||||
|
||||
receiptInfo = _.flow(
|
||||
o => _.set('paper', o.active, o),
|
||||
_.assign(defaults),
|
||||
_.pick(fields),
|
||||
)(receiptInfo)
|
||||
|
||||
return (receiptInfo.paper || receiptInfo.sms) ?
|
||||
_.set('receiptInfo', receiptInfo, ret) :
|
||||
ret
|
||||
}
|
||||
|
||||
|
||||
/* TODO: Simplify this. */
|
||||
const buildTriggers = (allTriggers) => {
|
||||
const buildTriggers = allTriggers => {
|
||||
const normalTriggers = []
|
||||
const customTriggers = _.filter(o => {
|
||||
if (_.isEmpty(o.customInfoRequestId) || _.isNil(o.customInfoRequestId)) normalTriggers.push(o)
|
||||
|
|
@ -82,7 +96,6 @@ const staticConfig = ({ currentConfigVersion, deviceId, deviceName, pq, settings
|
|||
|
||||
const staticConf = _.flow(
|
||||
_.pick([
|
||||
'areThereAvailablePromoCodes',
|
||||
'coins',
|
||||
'configVersion',
|
||||
'timezone'
|
||||
|
|
@ -157,7 +170,7 @@ const dynamicConfig = ({ deviceId, operatorId, pid, pq, settings, }) => {
|
|||
state.pids = _.update(operatorId, _.set(deviceId, { pid, ts: Date.now() }), state.pids)
|
||||
|
||||
return _.flow(
|
||||
_.pick(['balances', 'cassettes', 'coins', 'rates']),
|
||||
_.pick(['areThereAvailablePromoCodes', 'balances', 'cassettes', 'coins', 'rates']),
|
||||
|
||||
_.update('cassettes', massageCassettes),
|
||||
|
||||
|
|
@ -172,7 +185,8 @@ const dynamicConfig = ({ deviceId, operatorId, pid, pq, settings, }) => {
|
|||
|
||||
/* Group the separate objects by cryptoCode */
|
||||
/* { balances, coins, rates } => { cryptoCode: { balance, ask, bid, cashIn, cashOut }, ... } */
|
||||
({ balances, cassettes, coins, rates }) => ({
|
||||
({ areThereAvailablePromoCodes, balances, cassettes, coins, rates }) => ({
|
||||
areThereAvailablePromoCodes,
|
||||
cassettes,
|
||||
coins: _.flow(
|
||||
_.reduce(
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ type MachineInfo {
|
|||
}
|
||||
|
||||
type ReceiptInfo {
|
||||
paper: Boolean!
|
||||
sms: Boolean!
|
||||
operatorWebsite: Boolean!
|
||||
operatorEmail: Boolean!
|
||||
|
|
@ -85,7 +86,6 @@ type Terms {
|
|||
type StaticConfig {
|
||||
configVersion: Int!
|
||||
|
||||
areThereAvailablePromoCodes: Boolean!
|
||||
coins: [Coin!]!
|
||||
enablePaperWalletOnly: Boolean!
|
||||
hasLightning: Boolean!
|
||||
|
|
@ -136,6 +136,7 @@ type Cassettes {
|
|||
}
|
||||
|
||||
type DynamicConfig {
|
||||
areThereAvailablePromoCodes: Boolean!
|
||||
cassettes: Cassettes
|
||||
coins: [DynamicCoinValues!]!
|
||||
reboot: Boolean!
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue