diff --git a/package-lock.json b/package-lock.json index 80379f3..49eb58c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@mojaloop/reporting-hub-bop-api-svc", - "version": "1.0.18", + "version": "1.0.19", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@mojaloop/reporting-hub-bop-api-svc", - "version": "1.0.18", + "version": "1.0.19", "license": "Apache-2.0", "dependencies": { "@ory/keto-client": "^0.6.0-alpha.6", diff --git a/package.json b/package.json index fa1eb8e..e09fb23 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@mojaloop/reporting-hub-bop-api-svc", - "version": "1.0.18", + "version": "1.0.19", "description": "Reporting API", "scripts": { "postinstall__new": "patch-package", diff --git a/src/schema/TransferSummary/Query.ts b/src/schema/TransferSummary/Query.ts index c9c8986..0fb32f4 100644 --- a/src/schema/TransferSummary/Query.ts +++ b/src/schema/TransferSummary/Query.ts @@ -40,24 +40,24 @@ const Query = extendType({ return ctx.centralLedger.$queryRawUnsafe(` SELECT - COUNT(tF.transferId) as count, + COUNT(t.transferId) as count, SUM(t.amount) as amount, IF(${!!fields.payerDFSP}, pPayer.name, NULL) AS payerDFSP, IF(${!!fields.payeeDFSP}, pPayee.name, NULL) AS payeeDFSP, IF(${!!fields.currency}, c.currencyId, NULL) AS currency, IF(${!!fields.errorCode}, tE.errorCode, NULL) AS errorCode FROM - transferFulfilment tF - INNER JOIN transfer t ON t.transferId = tF.transferId - INNER JOIN transferParticipant tPPayer ON tPPayer.transferId = tF.transferId + transfer t + LEFT JOIN transferFulfilment tF ON t.transferId = tF.transferId + LEFT JOIN transferParticipant tPPayer ON tPPayer.transferId = tF.transferId AND tPPayer.transferParticipantRoleTypeId = (SELECT transferParticipantRoleTypeId from transferParticipantRoleType WHERE name = 'PAYER_DFSP') - INNER JOIN participantCurrency pCPayer ON pCPayer.participantCurrencyId = tPPayer.participantCurrencyId - INNER JOIN participant pPayer ON pPayer.participantId = pCPayer.participantId - INNER JOIN transferParticipant tPPayee ON tPPayee.transferId = tF.transferId + LEFT JOIN participantCurrency pCPayer ON pCPayer.participantCurrencyId = tPPayer.participantCurrencyId + LEFT JOIN participant pPayer ON pPayer.participantId = pCPayer.participantId + LEFT JOIN transferParticipant tPPayee ON tPPayee.transferId = tF.transferId AND tPPayee.transferParticipantRoleTypeId = (SELECT transferParticipantRoleTypeId from transferParticipantRoleType WHERE name = 'PAYEE_DFSP') - INNER JOIN participantCurrency pCPayee ON pCPayee.participantCurrencyId = tPPayee.participantCurrencyId - INNER JOIN participant pPayee ON pPayee.participantId = pCPayee.participantId - INNER JOIN currency c on t.currencyId = c.currencyId + LEFT JOIN participantCurrency pCPayee ON pCPayee.participantCurrencyId = tPPayee.participantCurrencyId + LEFT JOIN participant pPayee ON pPayee.participantId = pCPayee.participantId + LEFT JOIN currency c on t.currencyId = c.currencyId LEFT JOIN transferError tE on t.transferId = tE.transferId WHERE TRUE AND IF(${!!args.filter?.startDate}, t.createdDate >= '${args.filter?.startDate}', TRUE)