feat: add graphql support (#349)
* fix: eslint warnings * refactor: use ramda + sanctuary instead of lodash * refactor: use prettier-standard for formatting * feat: enable security * feat: add graphql * chore: remove trailing commas from linter * docs: new scripts on react and new-admin-server * feat: handle authentication on graphql * fix: perf improvement to date picker * chore: add insecure-dev script to run servers
This commit is contained in:
parent
49f434f1d1
commit
b8e0c2175b
182 changed files with 8827 additions and 4623 deletions
39
lib/new-admin/config/index.js
Normal file
39
lib/new-admin/config/index.js
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
const _ = require('lodash/fp')
|
||||
|
||||
const { COIN_LIST: coins } = require('./coins')
|
||||
const { ACCOUNT_LIST: accounts } = require('./accounts')
|
||||
|
||||
const countries = require('../../../countries.json')
|
||||
const currenciesRec = require('../../../currencies.json')
|
||||
const languageRec = require('../../../languages.json')
|
||||
|
||||
function massageCurrencies (currencies) {
|
||||
const convert = r => ({
|
||||
code: r['Alphabetic Code'],
|
||||
display: r['Currency']
|
||||
})
|
||||
const top5Codes = ['USD', 'EUR', 'GBP', 'CAD', 'AUD']
|
||||
const mapped = _.map(convert, currencies)
|
||||
const codeToRec = code => _.find(_.matchesProperty('code', code), mapped)
|
||||
const top5 = _.map(codeToRec, top5Codes)
|
||||
const raw = _.uniqBy(_.get('code'), _.concat(top5, mapped))
|
||||
return raw.filter(r => r.code[0] !== 'X' && r.display.indexOf('(') === -1)
|
||||
}
|
||||
|
||||
const mapLanguage = lang => {
|
||||
const arr = lang.split('-')
|
||||
const code = arr[0]
|
||||
const country = arr[1]
|
||||
const langNameArr = languageRec.lang[code]
|
||||
if (!langNameArr) return null
|
||||
const langName = langNameArr[0]
|
||||
if (!country) return { code: lang, display: langName }
|
||||
return { code: lang, display: `${langName} [${country}]` }
|
||||
}
|
||||
|
||||
const supportedLanguages = languageRec.supported
|
||||
|
||||
const languages = supportedLanguages.map(mapLanguage).filter(r => r)
|
||||
const currencies = massageCurrencies(currenciesRec)
|
||||
|
||||
module.exports = { coins, accounts, countries, currencies, languages }
|
||||
Loading…
Add table
Add a link
Reference in a new issue