urBackend icon indicating copy to clipboard operation
urBackend copied to clipboard

[Bug] mail.controller: getMailLogs returns hardcoded 50 records with no pagination support

Open Kirtan-pc opened this issue 5 months ago • 3 comments

Description

In mail.controller.js fetches the last 50 mail logs with .limit(50) and no pagination. For projects that send thousands of emails, users have no way to paginate beyond the most recent 50, making audit/debugging impossible and causing misleading data display in the dashboard.

Steps to Reproduce

  1. Configure a project that has sent > 50 emails.
  2. Call GET /api/mail/logs with x-api-key: <sk_live_...>.
  3. Observe that only the 50 most recent logs are ever returned regardless of page or limit query params.

Expected Behaviour

The endpoint should honour page and limit query parameters (e.g., ?page=2&limit=25) and return a paginated response with total, page, and limit metadata matching the API's standard format.

Actual Behaviour

Response always contains at most 50 records with no total count or pagination cursor, making it impossible for large projects to access older log entries.

Kirtan-pc avatar Jun 07 '26 09:06 Kirtan-pc

Hi @yash-pouranik ,

I would like to work on this issue under GSSoC 2026.

Could you please assign this issue to me?

Thank you!

Kirtan-pc avatar Jun 07 '26 09:06 Kirtan-pc

@Kirtan-pc I reviewed the endpoint, and the issue is valid. GET /api/mail/logs currently hard-caps results to the latest 50 records in mail.controller.js:393, and it does not accept page / limit query params or return pagination metadata. That means older mail logs are inaccessible for projects with high mail volume, which is a real usability gap for audit/debugging.

A small correction: the repo’s standard API response shape is success/data/message, so the implementation should follow that pattern rather than a separate custom format. But the core problem you reported is accurate.

you want to take this on ?

Nitin-kumar-yadav1307 avatar Jun 08 '26 05:06 Nitin-kumar-yadav1307

Hey @Nitin-kumar-yadav1307, Yes I would like to fix this issue under GSSOC26. Thank you for the opportunity

Kirtan-pc avatar Jun 08 '26 06:06 Kirtan-pc