diff --git a/lib/logs.js b/lib/logs.js index 3b8421bf..8187e23e 100644 --- a/lib/logs.js +++ b/lib/logs.js @@ -1,8 +1,9 @@ const _ = require('lodash/fp') -const { format } = require('date-fns/fp') +const { format, isValid } = require('date-fns/fp') const { utcToZonedTime } = require('date-fns-tz/fp') const db = require('./db') +const logger = require('./logger') const pgp = require('pg-promise')() const getMachineName = require('./machine-loader').getMachineName @@ -118,6 +119,10 @@ function logDateFormat (timezone, logs, fields) { field => { if (_.isNil(log[field])) return null + if (!isValid(log[field])) { + logger.warn(`Tried to convert to ${timezone} timezone the value ${log[field]} and failed. Returning original value...`) + return log[field] + } const date = utcToZonedTime(timezone, log[field]) return `${format('yyyy-MM-dd', date)}T${format('HH:mm:ss.SSS', date)}` }, diff --git a/lib/new-admin/graphql/resolvers/transaction.resolver.js b/lib/new-admin/graphql/resolvers/transaction.resolver.js index e41c17f9..97f25861 100644 --- a/lib/new-admin/graphql/resolvers/transaction.resolver.js +++ b/lib/new-admin/graphql/resolvers/transaction.resolver.js @@ -23,10 +23,10 @@ const resolvers = { transactions.batch(from, until, limit, offset, deviceId, txClass, machineName, customerName, fiatCode, cryptoCode, toAddress, status, excludeTestingCustomers), transactionsCsv: (...[, { from, until, limit, offset, txClass, machineName, customerName, fiatCode, cryptoCode, toAddress, status, timezone, excludeTestingCustomers, simplified }]) => transactions.batch(from, until, limit, offset, null, txClass, machineName, customerName, fiatCode, cryptoCode, toAddress, status, excludeTestingCustomers, simplified) - .then(data => parseAsync(logDateFormat(timezone, data, ['created', 'sendTime']))), + .then(data => parseAsync(logDateFormat(timezone, data, ['created', 'sendTime', 'publishedAt']))), transactionCsv: (...[, { id, txClass, timezone }]) => transactions.getTx(id, txClass).then(data => - parseAsync(logDateFormat(timezone, [data], ['created', 'sendTime'])) + parseAsync(logDateFormat(timezone, [data], ['created', 'sendTime', 'publishedAt'])) ), txAssociatedDataCsv: (...[, { id, txClass, timezone }]) => transactions.getTxAssociatedData(id, txClass).then(data => diff --git a/lib/new-admin/services/transactions.js b/lib/new-admin/services/transactions.js index 0f111937..5155a7ad 100644 --- a/lib/new-admin/services/transactions.js +++ b/lib/new-admin/services/transactions.js @@ -138,7 +138,7 @@ function advancedBatch (data) { 'txVersion', 'publishedAt', 'termsAccepted', 'layer2Address', 'commissionPercentage', 'rawTickerPrice', 'receivedCryptoAtoms', 'discount', 'txHash', 'customerPhone', 'customerIdCardDataNumber', - 'customerIdCardDataExpiration', 'customerIdCardData', 'customerName', + 'customerIdCardDataExpiration', 'customerIdCardData', 'customerName', 'sendTime', 'customerFrontCameraPath', 'customerIdCardPhotoPath', 'expired', 'machineName', 'walletScore'] const addAdvancedFields = _.map(it => ({ diff --git a/public/asset-manifest.json b/public/asset-manifest.json index 517a388f..bd3dcd28 100644 --- a/public/asset-manifest.json +++ b/public/asset-manifest.json @@ -1,7 +1,7 @@ { "files": { - "main.js": "/static/js/main.c41bff86.chunk.js", - "main.js.map": "/static/js/main.c41bff86.chunk.js.map", + "main.js": "/static/js/main.25dad505.chunk.js", + "main.js.map": "/static/js/main.25dad505.chunk.js.map", "runtime-main.js": "/static/js/runtime-main.5b925903.js", "runtime-main.js.map": "/static/js/runtime-main.5b925903.js.map", "static/js/2.539ca5ff.chunk.js": "/static/js/2.539ca5ff.chunk.js", @@ -154,6 +154,6 @@ "entrypoints": [ "static/js/runtime-main.5b925903.js", "static/js/2.539ca5ff.chunk.js", - "static/js/main.c41bff86.chunk.js" + "static/js/main.25dad505.chunk.js" ] } \ No newline at end of file diff --git a/public/index.html b/public/index.html index a540a8cf..25c6bf51 100644 --- a/public/index.html +++ b/public/index.html @@ -1 +1 @@ -