fix: rework wallet screen

This commit is contained in:
Taranto 2020-04-07 19:03:18 +01:00 committed by Josh Harvey
parent 1f7ae74b42
commit 1f6d272aa0
103 changed files with 2094 additions and 3892 deletions

View file

@ -17,7 +17,7 @@ const funding = require('../funding')
const supervisor = require('../supervisor')
const serverLogs = require('../server-logs')
const pairing = require('../pairing')
const { accounts, coins, countries, currencies, languages } = require('../config')
const { accounts: accountsConfig, coins, countries, currencies, languages } = require('../config')
// TODO why does server logs messages can be null?
const typeDefs = gql`
@ -61,7 +61,7 @@ const typeDefs = gql`
}
type Customer {
name: String!
name: String
phone: String
totalTxs: Int
totalSpent: String
@ -71,7 +71,7 @@ const typeDefs = gql`
lastTxClass: String
}
type Account {
type AccountConfig {
code: String!
display: String!
class: String!
@ -156,7 +156,7 @@ const typeDefs = gql`
countries: [Country]
currencies: [Currency]
languages: [Language]
accounts: [Account]
accountsConfig: [AccountConfig]
cryptoCurrencies: [CryptoCurrency]
machines: [Machine]
customers: [Customer]
@ -166,6 +166,7 @@ const typeDefs = gql`
uptime: [ProcessStatus]
serverLogs: [ServerLog]
transactions: [Transaction]
accounts: [JSONObject]
config: JSONObject
}
@ -188,6 +189,8 @@ const typeDefs = gql`
serverSupportLogs: SupportLogsResponse
saveConfig(config: JSONObject): JSONObject
createPairingTotem(name: String!): String
saveAccount(account: JSONObject): [JSONObject]
saveAccounts(accounts: [JSONObject]): [JSONObject]
}
`
@ -202,7 +205,7 @@ const resolvers = {
countries: () => countries,
currencies: () => currencies,
languages: () => languages,
accounts: () => accounts,
accountsConfig: () => accountsConfig,
cryptoCurrencies: () => coins,
machines: () => machineLoader.getMachineNames(),
customers: () => customers.getCustomersList(),
@ -212,13 +215,16 @@ const resolvers = {
uptime: () => supervisor.getAllProcessInfo(),
serverLogs: () => serverLogs.getServerLogs(),
transactions: () => transactions.batch(),
config: () => settingsLoader.getConfig()
config: () => settingsLoader.getConfig(),
accounts: () => settingsLoader.getAccounts()
},
Mutation: {
machineAction: (...[, { deviceId, action }]) => machineAction({ deviceId, action }),
machineSupportLogs: (...[, { deviceId }]) => supportLogs.insert(deviceId),
createPairingTotem: (...[, { name }]) => pairing.totem(name),
serverSupportLogs: () => serverLogs.insert(),
saveAccount: (...[, { account }]) => settingsLoader.saveAccounts([account]),
saveAccounts: (...[, { accounts }]) => settingsLoader.saveAccounts(accounts),
saveConfig: (...[, { config }]) => settingsLoader.saveConfig(config)
.then(it => {
notify()