Skip to content

Commit 8a3f614

Browse files
authored
src/donations: Fix donation filter query (#612)
* src/donations: Fix donation filter query * fix: Include person's first and lastName in search * Allow to filter payments by id
1 parent 3089a38 commit 8a3f614

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

apps/api/src/donations/donations.service.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -385,11 +385,15 @@ export class DonationsService {
385385
lte: to,
386386
},
387387
paymentId: paymentId,
388+
payment: {
389+
status: paymentStatus,
390+
provider: paymentProvider,
391+
},
388392
OR: [
389-
{ payment: { status: paymentStatus } },
390-
{ payment: { provider: paymentProvider } },
391393
{ payment: { billingEmail: { contains: search } } },
392394
{ payment: { billingName: { contains: search } } },
395+
{ person: { firstName: { contains: search } } },
396+
{ person: { lastName: { contains: search } } },
393397
],
394398
targetVault: { campaign: { id: campaignId } },
395399
})
@@ -431,7 +435,7 @@ export class DonationsService {
431435
pageSize?: number,
432436
): Promise<ListDonationsDto<PaymentWithDonationCount>> {
433437
const whereClause = Prisma.validator<Prisma.PaymentWhereInput>()({
434-
// id: paymentId,
438+
id: paymentId,
435439
amount: {
436440
gte: minAmount,
437441
lte: maxAmount,

0 commit comments

Comments
 (0)