From 0ae8c691c2b139bde67f09429246b510099f3b80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Oliveira?= Date: Wed, 1 Sep 2021 14:59:23 +0100 Subject: [PATCH] fix: replace DateTime with Date and add gql resolver date name --- lib/new-admin/graphql/resolvers/scalar.resolver.js | 2 ++ new-lamassu-admin/src/pages/MachineLogs.js | 11 +++-------- new-lamassu-admin/src/pages/ServerLogs.js | 9 ++------- .../src/pages/Transactions/DetailsCard.js | 4 ++-- .../src/pages/Transactions/Transactions.js | 8 ++++---- 5 files changed, 13 insertions(+), 21 deletions(-) diff --git a/lib/new-admin/graphql/resolvers/scalar.resolver.js b/lib/new-admin/graphql/resolvers/scalar.resolver.js index e1a09c4d..57d556ae 100644 --- a/lib/new-admin/graphql/resolvers/scalar.resolver.js +++ b/lib/new-admin/graphql/resolvers/scalar.resolver.js @@ -1,6 +1,8 @@ const { GraphQLDateTime } = require('graphql-iso-date') const { GraphQLJSON, GraphQLJSONObject } = require('graphql-type-json') +GraphQLDateTime.name = 'Date' + const resolvers = { JSON: GraphQLJSON, JSONObject: GraphQLJSONObject, diff --git a/new-lamassu-admin/src/pages/MachineLogs.js b/new-lamassu-admin/src/pages/MachineLogs.js index 7d1be1f7..3075eb80 100644 --- a/new-lamassu-admin/src/pages/MachineLogs.js +++ b/new-lamassu-admin/src/pages/MachineLogs.js @@ -37,8 +37,8 @@ const GET_MACHINE_LOGS_CSV = gql` query MachineLogs( $deviceId: ID! $limit: Int - $from: DateTime - $until: DateTime + $from: Date + $until: Date $timezone: String ) { machineLogsCsv( @@ -52,12 +52,7 @@ const GET_MACHINE_LOGS_CSV = gql` ` const GET_MACHINE_LOGS = gql` - query MachineLogs( - $deviceId: ID! - $limit: Int - $from: DateTime - $until: DateTime - ) { + query MachineLogs($deviceId: ID!, $limit: Int, $from: Date, $until: Date) { machineLogs( deviceId: $deviceId limit: $limit diff --git a/new-lamassu-admin/src/pages/ServerLogs.js b/new-lamassu-admin/src/pages/ServerLogs.js index 37873b5a..73869344 100644 --- a/new-lamassu-admin/src/pages/ServerLogs.js +++ b/new-lamassu-admin/src/pages/ServerLogs.js @@ -57,12 +57,7 @@ const SHOW_ALL = { code: 'SHOW_ALL', display: 'Show all' } const NUM_LOG_RESULTS = 500 const GET_CSV = gql` - query ServerData( - $limit: Int - $from: DateTime - $until: DateTime - $timezone: String - ) { + query ServerData($limit: Int, $from: Date, $until: Date, $timezone: String) { serverLogsCsv( limit: $limit from: $from @@ -73,7 +68,7 @@ const GET_CSV = gql` ` const GET_SERVER_DATA = gql` - query ServerData($limit: Int, $from: DateTime, $until: DateTime) { + query ServerData($limit: Int, $from: Date, $until: Date) { serverVersion uptime { name diff --git a/new-lamassu-admin/src/pages/Transactions/DetailsCard.js b/new-lamassu-admin/src/pages/Transactions/DetailsCard.js index 3e4582e1..61a5f105 100644 --- a/new-lamassu-admin/src/pages/Transactions/DetailsCard.js +++ b/new-lamassu-admin/src/pages/Transactions/DetailsCard.js @@ -39,8 +39,8 @@ const TX_SUMMARY = gql` $txId: ID! $deviceId: ID! $limit: Int - $from: DateTime - $until: DateTime + $from: Date + $until: Date $txClass: String $timezone: String ) { diff --git a/new-lamassu-admin/src/pages/Transactions/Transactions.js b/new-lamassu-admin/src/pages/Transactions/Transactions.js index 6576483c..08f52736 100644 --- a/new-lamassu-admin/src/pages/Transactions/Transactions.js +++ b/new-lamassu-admin/src/pages/Transactions/Transactions.js @@ -34,8 +34,8 @@ const GET_DATA = gql` const GET_TRANSACTIONS_CSV = gql` query transactions( $limit: Int - $from: DateTime - $until: DateTime + $from: Date + $until: Date $timezone: String ) { transactionsCsv( @@ -59,8 +59,8 @@ const GET_TRANSACTION_FILTERS = gql` const GET_TRANSACTIONS = gql` query transactions( $limit: Int - $from: DateTime - $until: DateTime + $from: Date + $until: Date $txClass: String $machineName: String $customerName: String