[PR #1929] [MERGED] fix: default pagination on documents list API #1937

Closed
opened 2026-02-26 20:31:44 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/documenso/documenso/pull/1929
Author: @samuel-cglg
Created: 7/28/2025
Status: Merged
Merged: 8/28/2025
Merged by: @Mythie

Base: mainHead: fix-default-documents-pagination


📝 Commits (2)

  • e9f6b06 fix: default pagination on documents list API
  • 616e8dd Merge branch 'main' into fix-default-documents-pagination

📊 Changes

1 file changed (+2 additions, -2 deletions)

View changed files

📝 packages/api/v1/schema.ts (+2 -2)

📄 Description

Description

When requesting a list of documents via GET /documents endpoint without perPage parameter, the API sends back only one document per page.

The default pagination parameters are conflicted between the schema definition (1 document per page declared) vs the implementation (10 documents per page).

Endpoint query schema (packages/api/v1/schema.ts):

export const ZGetDocumentsQuerySchema = z.object({
  page: z.coerce.number().min(1).optional().default(1),
  perPage: z.coerce.number().min(1).optional().default(1),
});

Enpoint implementation (packages/api/v1/implementation.ts):

  getDocuments: authenticatedMiddleware(async (args, user, team) => {
    const page = Number(args.query.page) || 1;
    const perPage = Number(args.query.perPage) || 10;

See the perPage default value difference between schema (1) and implementation (10).

none

Changes Made

Changed the schema definition to match its implementation (10 documents per page by default).

Testing Performed

Tested in local

Checklist

  • I have tested these changes locally and they work as expected.
  • I have added/updated tests that prove the effectiveness of these changes.
  • I have updated the documentation to reflect these changes, if applicable.
  • I have followed the project's coding style guidelines.
  • I have addressed the code review feedback from the previous submission, if applicable.

Additional Notes


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/documenso/documenso/pull/1929 **Author:** [@samuel-cglg](https://github.com/samuel-cglg) **Created:** 7/28/2025 **Status:** ✅ Merged **Merged:** 8/28/2025 **Merged by:** [@Mythie](https://github.com/Mythie) **Base:** `main` ← **Head:** `fix-default-documents-pagination` --- ### 📝 Commits (2) - [`e9f6b06`](https://github.com/documenso/documenso/commit/e9f6b060960ab1fb24444531218e3bbd8c1fb156) fix: default pagination on documents list API - [`616e8dd`](https://github.com/documenso/documenso/commit/616e8dd0d8a1fa9e7fd806e10561053ccbd8695a) Merge branch 'main' into fix-default-documents-pagination ### 📊 Changes **1 file changed** (+2 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `packages/api/v1/schema.ts` (+2 -2) </details> ### 📄 Description ## Description When requesting a list of documents via GET /documents endpoint without `perPage` parameter, the API sends back only one document per page. The default pagination parameters are conflicted between the schema definition (1 document per page declared) vs the implementation (10 documents per page). Endpoint query schema (`packages/api/v1/schema.ts`): ```ts export const ZGetDocumentsQuerySchema = z.object({ page: z.coerce.number().min(1).optional().default(1), perPage: z.coerce.number().min(1).optional().default(1), }); ``` Enpoint implementation (`packages/api/v1/implementation.ts`): ```ts getDocuments: authenticatedMiddleware(async (args, user, team) => { const page = Number(args.query.page) || 1; const perPage = Number(args.query.perPage) || 10; ``` See the perPage default value difference between schema (1) and implementation (10). ## Related Issue none ## Changes Made Changed the schema definition to match its implementation (10 documents per page by default). ## Testing Performed Tested in local ## Checklist <!--- Please check the boxes that apply to this pull request. --> <!--- You can add or remove items as needed. --> - [x] I have tested these changes locally and they work as expected. - [ ] I have added/updated tests that prove the effectiveness of these changes. - [ ] I have updated the documentation to reflect these changes, if applicable. - [x] I have followed the project's coding style guidelines. - [ ] I have addressed the code review feedback from the previous submission, if applicable. ## Additional Notes <!--- Provide any additional context or notes for the reviewers. --> <!--- This might include details about design decisions, potential concerns, or anything else relevant. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-26 20:31:44 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/documenso#1937
No description provided.