refactor: reuse tx to csv gql query and overall function simplification

This commit is contained in:
José Oliveira 2021-08-26 13:23:52 +01:00 committed by Josh Harvey
parent 5826a29c53
commit fe518b21d7
4 changed files with 74 additions and 69 deletions

View file

@ -301,8 +301,7 @@ const typeDefs = gql`
offset: Int
deviceId: ID
): [Transaction]
transactionsCsv(from: Date, until: Date, limit: Int, offset: Int): String
simplifiedTransactionsCsv(from: Date, until: Date, limit: Int, offset: Int): String
transactionsCsv(from: Date, until: Date, limit: Int, offset: Int, simplified: Boolean): String
accounts: JSONObject
config: JSONObject
blacklist: [Blacklist]
@ -398,10 +397,8 @@ const resolvers = {
serverLogs.getServerLogs(from, until, limit, offset).then(parseAsync),
transactions: (...[, { from, until, limit, offset, deviceId }]) =>
transactions.batch(from, until, limit, offset, deviceId),
transactionsCsv: (...[, { from, until, limit, offset }]) =>
transactions.batch(from, until, limit, offset).then(parseAsync),
simplifiedTransactionsCsv: (...[, { from, until, limit, offset }]) =>
transactions.simplifiedBatch(from, until, limit, offset).then(parseAsync),
transactionsCsv: (...[, { from, until, limit, offset, simplified }]) =>
transactions.batch(from, until, limit, offset, null, simplified).then(parseAsync),
config: () => settingsLoader.loadLatestConfigOrNone(),
accounts: () => settingsLoader.showAccounts(),
blacklist: () => blacklist.getBlacklist(),