fix: added timestamp parameters for a date range on the gql queries for

machineLogs, serverLogs and transactions

feat: added optional limit and offset variables for the logs queries,
for filtering and pagination

feat: adapted the LogsDownloaderPopper to download the logs by whats set
on the filters

fix: improved code readability

fix: avoid errors when the range option is selected and no range is
actually selected
This commit is contained in:
Liordino Neto 2020-07-16 21:50:38 -03:00 committed by Josh Harvey
parent 37ea3a04c3
commit f641e605a4
7 changed files with 109 additions and 68 deletions

View file

@ -195,12 +195,12 @@ const typeDefs = gql`
machines: [Machine]
customers: [Customer]
customer(customerId: ID!): Customer
machineLogs(deviceId: ID!): [MachineLog]
machineLogs(deviceId: ID!, from: Date, until: Date, limit: Int, offset: Int): [MachineLog]
funding: [CoinFunds]
serverVersion: String!
uptime: [ProcessStatus]
serverLogs: [ServerLog]
transactions: [Transaction]
serverLogs(from: Date, until: Date, limit: Int, offset: Int): [ServerLog]
transactions(from: Date, until: Date, limit: Int, offset: Int): [Transaction]
accounts: JSONObject
config: JSONObject
}
@ -250,11 +250,14 @@ const resolvers = {
customers: () => customers.getCustomersList(),
customer: (...[, { customerId }]) => customers.getCustomerById(customerId),
funding: () => funding.getFunding(),
machineLogs: (...[, { deviceId }]) => logs.simpleGetMachineLogs(deviceId),
machineLogs: (...[, { deviceId, from, until, limit, offset }]) =>
logs.simpleGetMachineLogs(deviceId, from, until, limit, offset),
serverVersion: () => serverVersion,
uptime: () => supervisor.getAllProcessInfo(),
serverLogs: () => serverLogs.getServerLogs(),
transactions: () => transactions.batch(),
serverLogs: (...[, { from, until, limit, offset }]) =>
serverLogs.getServerLogs(from, until, limit, offset),
transactions: (...[, { from, until, limit, offset }]) =>
transactions.batch(from, until, limit, offset),
config: () => settingsLoader.getConfig(),
accounts: () => settingsLoader.getAccounts()
},