Skip to content

fix(payments): validate status, date range and paging on payment queries - #812

Merged
Qoder-Voidd merged 1 commit into
Akazajan:mainfrom
kiel997:fix/constrain-payment-queries
Oct 17, 2026
Merged

Qoder-Voidd merged 1 commit into
Akazajan:mainfrom
kiel997:fix/constrain-payment-queries

Conversation

@kiel997

@kiel997 kiel997 commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

closes #636

What

Constrains payment queries to supported statuses, valid date ranges and bounded pages.

Changes

  • PaymentQuery: added status (validated against PaymentStatus), fromDate/toDate (ISO dates, toDate >= fromDate, range capped at 366 days) and an upper bound on page (10,000; limit was already capped at 100 by PaginationDto)
  • PaymentFailureQueryDto: fromDate/toDate are now validated as ISO dates with the same range rule (previously any string was accepted)
  • FindPaymentsProvider applies the new filters with andWhere, so non-admin users stay scoped to their own payments
  • A date-only toDate includes the whole day
  • Tests for malformed filters and for user vs staff/admin scoping

Testing

jest payments.service.spec → 17 passed

Notes

  • Whole-project TypeScript builds already fail on main (bookings, email queue, missing packages), so I ran jest with diagnostics off and type-checked only the files I changed.
  • The 366-day maximum and the page cap of 10,000 are my choices; happy to change them.
  • page is redeclared in PaymentQuery because PaginationDto has no upper bound and is outside this task's scope.

@drips-wave

drips-wave Bot commented Oct 17, 2026

Copy link
Copy Markdown

@kiel997 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@kiel997

kiel997 commented Oct 17, 2026

Copy link
Copy Markdown
Contributor Author

please kindly review

@Qoder-Voidd Qoder-Voidd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Qoder-Voidd
Qoder-Voidd merged commit 22b817a into Akazajan:main Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BE-50 — Validate payment-list filters and pagination

2 participants