implement pageviews, events, and channels queries

This commit is contained in:
Francis Cao 2025-08-05 00:37:44 -07:00
parent c1cad16cb9
commit 0a0c1f27c6
24 changed files with 521 additions and 86 deletions

View file

@ -46,22 +46,6 @@ export async function GET(
if (SESSION_COLUMNS.includes(type)) {
const data = await getSessionMetrics(websiteId, { type, limit, offset }, filters);
if (type === 'language') {
const combined = {};
for (const { x, y } of data) {
const key = String(x).toLowerCase().split('-')[0];
if (combined[key] === undefined) {
combined[key] = { x: key, y };
} else {
combined[key].y += y;
}
}
return json(Object.values(combined));
}
return json(data);
}