Skip to content

Commit

Permalink
Fix currency filter
Browse files Browse the repository at this point in the history
  • Loading branch information
kirgene committed Nov 29, 2021
1 parent 5571233 commit 197191f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
8 changes: 1 addition & 7 deletions src/schema/Transfer/Query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,7 @@ const Query = extendType({
take: args.limit ?? 100,
skip: args.offset || undefined,
orderBy: [{ createdDate: 'desc' }],
where: {
createdDate: {
gte: args.filter?.startDate || undefined,
lt: args.filter?.endDate || undefined,
},
...transferFilter,
},
where: transferFilter,
});
return transfers.map((tr) => ({
transferId: tr.transferId,
Expand Down
9 changes: 8 additions & 1 deletion src/schema/Transfer/helpers/transferFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ export const createTransferFilter = (participants?: string[], filter?: NexusGenI

const transferFilter: transferWhereInput = {};

transferFilter.createdDate = {
gte: filter?.startDate || undefined,
lt: filter?.endDate || undefined,
};

if (filter?.errorCode) {
transferFilter.transferError = {
some: {
Expand Down Expand Up @@ -65,7 +70,9 @@ export const createTransferFilter = (participants?: string[], filter?: NexusGenI
}

if (filter?.currency) {
transferFilter.currency = filter?.currency;
transferFilter.currency = {
currencyId: filter?.currency,
};
}

if (filter?.payee?.idType || filter?.payee?.idValue || filter?.payer?.idType || filter?.payer?.idValue) {
Expand Down

0 comments on commit 197191f

Please sign in to comment.