Skip to content

Commit

Permalink
Fix transferSummary query.
Browse files Browse the repository at this point in the history
  • Loading branch information
kirgene committed Nov 22, 2021
1 parent 916f690 commit 475648d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
20 changes: 10 additions & 10 deletions src/schema/TransferSummary/Query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 475648d

Please sign in to comment.