remove edge cases from server side
This commit is contained in:
parent
c2282e61b4
commit
a60a4f8793
2 changed files with 281 additions and 239 deletions
|
|
@ -165,18 +165,6 @@ function configDeleteField (scope, fieldCode) {
|
|||
}
|
||||
}
|
||||
|
||||
function addEdgeCases (config) {
|
||||
const isCashOutEnabled = r => r.fieldLocator.fieldScope.machine !== 'global' &&
|
||||
r.fieldLocator.code === 'cashOutEnabled' &&
|
||||
r.fieldValue.value
|
||||
|
||||
const cashOutEnabledExists = _.some(isCashOutEnabled, config)
|
||||
const scope = {crypto: 'global', machine: 'global'}
|
||||
const newField = configAddField(scope, 'cashOutEnabled', cashOutEnabledExists)
|
||||
|
||||
return mergeValues(config, newField)
|
||||
}
|
||||
|
||||
function modifyConfig (newFields) {
|
||||
const TransactionMode = pgp.txMode.TransactionMode
|
||||
const isolationLevel = pgp.txMode.isolationLevel
|
||||
|
|
@ -185,7 +173,7 @@ function modifyConfig (newFields) {
|
|||
function transaction (t) {
|
||||
return loadRecentConfig()
|
||||
.then(oldConfig => {
|
||||
const doSave = _.flow(mergeValues, addEdgeCases, save)
|
||||
const doSave = _.flow(mergeValues, save)
|
||||
return doSave(oldConfig, newFields)
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue