[PR #2394] fix: implement query parameter filtering for templates #2274

Open
opened 2026-02-26 20:33:11 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/documenso/documenso/pull/2394
Author: @jormigo
Created: 1/17/2026
Status: 🔄 Open

Base: mainHead: feat/api-v2-template-query-param


📝 Commits (2)

  • a39a540 fix: implement query parameter filtering for templates
  • 65a81c1 Merge branch 'main' into feat/api-v2-template-query-param

📊 Changes

1 file changed (+12 additions, -0 deletions)

View changed files

📝 packages/lib/server-only/template/find-templates.ts (+12 -0)

📄 Description

fix: implement query parameter filtering for templates

Description

This PR fixes an issue where the query parameter in the api/v2/template endpoint was ignored. It implements search logic in the findTemplates function to allow filtering templates by their properties and recipient details, aligning the behavior with the document search implementation.

Fixes https://github.com/documenso/documenso/issues/2393

Changes Made

  • Update findTemplates signature to accept query parameter
  • Implement search filtering for title, externalId, recipients.name, and recipients.email
  • Match search logic with findDocuments implementation (case-insensitive contains)

Testing Performed

  • Verified locally using curl requests against the running API.
  • Scenario 1: Query test correctly found 1 templates matching the criteria (title or recipient).
  • Scenario 2: Query sample correctly found 1 templates matching the criteria.
  • Scenario 3: Non-matching query returned 0 results.
  • Scenario 4: No query parameter returned all available templates.

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

The search logic was explicitly aligned with findDocuments to ensure consistency across the API.


🔄 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/2394 **Author:** [@jormigo](https://github.com/jormigo) **Created:** 1/17/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feat/api-v2-template-query-param` --- ### 📝 Commits (2) - [`a39a540`](https://github.com/documenso/documenso/commit/a39a54083acd89ad6000e3407fb1851540b47a70) fix: implement query parameter filtering for templates - [`65a81c1`](https://github.com/documenso/documenso/commit/65a81c15bdbcc6cc30831557e3e4d002362eceba) Merge branch 'main' into feat/api-v2-template-query-param ### 📊 Changes **1 file changed** (+12 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `packages/lib/server-only/template/find-templates.ts` (+12 -0) </details> ### 📄 Description fix: implement query parameter filtering for templates ## Description This PR fixes an issue where the `query` parameter in the `api/v2/template` endpoint was ignored. It implements search logic in the [findTemplates](cci:1://file:///Users/jorge/dev/documenso/packages/lib/server-only/template/find-templates.ts:19:0-113:2) function to allow filtering templates by their properties and recipient details, aligning the behavior with the document search implementation. ## Related Issue Fixes https://github.com/documenso/documenso/issues/2393 ## Changes Made - Update [findTemplates](cci:1://file:///Users/jorge/dev/documenso/packages/lib/server-only/template/find-templates.ts:19:0-113:2) signature to accept `query` parameter - Implement search filtering for `title`, `externalId`, `recipients.name`, and `recipients.email` - Match search logic with [findDocuments](cci:1://file:///Users/jorge/dev/documenso/packages/lib/server-only/document/find-documents.ts:33:0-279:2) implementation (case-insensitive contains) ## Testing Performed - Verified locally using `curl` requests against the running API. - **Scenario 1**: Query `test` correctly found 1 templates matching the criteria (title or recipient). - **Scenario 2**: Query `sample` correctly found 1 templates matching the criteria. - **Scenario 3**: Non-matching query returned 0 results. - **Scenario 4**: No query parameter returned all available templates. ## Checklist - [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 The search logic was explicitly aligned with [findDocuments](cci:1://file:///Users/jorge/dev/documenso/packages/lib/server-only/document/find-documents.ts:33:0-279:2) to ensure consistency across the API. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#2274
No description provided.