From 17b261df1f25f2fed585be6bdbad1f390648a4ab Mon Sep 17 00:00:00 2001 From: Jorge Ramirez Date: Mon, 26 Jan 2026 20:00:37 -0800 Subject: [PATCH] fix(api): add take parameter to template search query for pagination (#2396) This PR fixes a bug in the `/api/v2/template` endpoint where the pagination parameter `perPage` was being ignored. Previously, the endpoint would return all matching templates regardless of the requested limit, which could lead to performance issues and incorrect API behavior. --- packages/lib/server-only/template/find-templates.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/lib/server-only/template/find-templates.ts b/packages/lib/server-only/template/find-templates.ts index 3a46dd4b4..621459255 100644 --- a/packages/lib/server-only/template/find-templates.ts +++ b/packages/lib/server-only/template/find-templates.ts @@ -79,6 +79,7 @@ export const findTemplates = async ({ }, }, skip: Math.max(page - 1, 0) * perPage, + take: perPage, orderBy: { createdAt: 'desc', },