Skip to content

Commit

Permalink
src/donations: Fix donation filter query (#612)
Browse files Browse the repository at this point in the history
* src/donations: Fix donation filter query

* fix: Include person's first and lastName in search

* Allow to filter payments by id
  • Loading branch information
sashko9807 authored Mar 22, 2024
1 parent 3089a38 commit 8a3f614
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions apps/api/src/donations/donations.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -385,11 +385,15 @@ export class DonationsService {
lte: to,
},
paymentId: paymentId,
payment: {
status: paymentStatus,
provider: paymentProvider,
},
OR: [
{ payment: { status: paymentStatus } },
{ payment: { provider: paymentProvider } },
{ payment: { billingEmail: { contains: search } } },
{ payment: { billingName: { contains: search } } },
{ person: { firstName: { contains: search } } },
{ person: { lastName: { contains: search } } },
],
targetVault: { campaign: { id: campaignId } },
})
Expand Down Expand Up @@ -431,7 +435,7 @@ export class DonationsService {
pageSize?: number,
): Promise<ListDonationsDto<PaymentWithDonationCount>> {
const whereClause = Prisma.validator<Prisma.PaymentWhereInput>()({
// id: paymentId,
id: paymentId,
amount: {
gte: minAmount,
lte: maxAmount,
Expand Down

0 comments on commit 8a3f614

Please sign in to comment.