Skip to content

OpenPanel is an open-source web and product analytics platform, an open-source alternative to Mixpanel with optional self-hosting.

api: add limit as query parameter

David Söderberg645b9ca9d4b7
diff --git a/apps/api/src/controllers/export.controller.ts b/apps/api/src/controllers/export.controller.ts
index 0477adbc6..d5b4ffc04 100644
--- a/apps/api/src/controllers/export.controller.ts
+++ b/apps/api/src/controllers/export.controller.ts
@@ -56,6 +56,7 @@ export async function events(
return;
}
+ const take = Math.max(Math.min(query.limit, 50), 1);
const cursor = (parseInt(query.page || '1', 10) || 1) - 1;
const options: GetEventListOptions = {
projectId,
@@ -65,7 +66,7 @@ export async function events(
startDate: query.start ? new Date(query.start) : undefined,
endDate: query.end ? new Date(query.end) : undefined,
cursor,
- take: 50,
+ take,
meta: false,
profile: true,
};