mirror of
https://github.com/umami-software/umami.git
synced 2026-02-07 22:27:16 +01:00
Updated pixel/link endpoints. Added name to rawQuery.
This commit is contained in:
parent
b9fbbc6453
commit
8a977b0164
18 changed files with 913 additions and 810 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import { canViewWebsite } from '@/permissions';
|
||||
import { EVENT_COLUMNS, SESSION_COLUMNS } from '@/lib/constants';
|
||||
import { EVENT_COLUMNS, EVENT_TYPE, FILTER_COLUMNS, SESSION_COLUMNS } from '@/lib/constants';
|
||||
import { getQueryFilters, parseRequest } from '@/lib/request';
|
||||
import { badRequest, json, unauthorized } from '@/lib/response';
|
||||
import { dateRangeParams, filterParams, searchParams } from '@/lib/schema';
|
||||
|
|
@ -50,21 +50,21 @@ export async function GET(
|
|||
}
|
||||
|
||||
if (EVENT_COLUMNS.includes(type)) {
|
||||
let data;
|
||||
const column = FILTER_COLUMNS[type] || type;
|
||||
|
||||
if (type === 'event') {
|
||||
data = await getEventExpandedMetrics(websiteId, { type, limit, offset }, filters);
|
||||
} else {
|
||||
data = await getPageviewExpandedMetrics(websiteId, { type, limit, offset }, filters);
|
||||
if (column === 'event_name') {
|
||||
filters.eventType = EVENT_TYPE.customEvent;
|
||||
}
|
||||
|
||||
return json(data);
|
||||
if (type === 'event') {
|
||||
return json(await getEventExpandedMetrics(websiteId, { type, limit, offset }, filters));
|
||||
} else {
|
||||
return json(await getPageviewExpandedMetrics(websiteId, { type, limit, offset }, filters));
|
||||
}
|
||||
}
|
||||
|
||||
if (type === 'channel') {
|
||||
const data = await getChannelExpandedMetrics(websiteId, filters);
|
||||
|
||||
return json(data);
|
||||
return json(await getChannelExpandedMetrics(websiteId, filters));
|
||||
}
|
||||
|
||||
return badRequest();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { canViewWebsite } from '@/permissions';
|
||||
import { EVENT_COLUMNS, SESSION_COLUMNS } from '@/lib/constants';
|
||||
import { EVENT_COLUMNS, EVENT_TYPE, FILTER_COLUMNS, SESSION_COLUMNS } from '@/lib/constants';
|
||||
import { getQueryFilters, parseRequest } from '@/lib/request';
|
||||
import { badRequest, json, unauthorized } from '@/lib/response';
|
||||
import {
|
||||
|
|
@ -50,21 +50,21 @@ export async function GET(
|
|||
}
|
||||
|
||||
if (EVENT_COLUMNS.includes(type)) {
|
||||
let data;
|
||||
const column = FILTER_COLUMNS[type] || type;
|
||||
|
||||
if (type === 'event') {
|
||||
data = await getEventMetrics(websiteId, { type, limit, offset }, filters);
|
||||
} else {
|
||||
data = await getPageviewMetrics(websiteId, { type, limit, offset }, filters);
|
||||
if (column === 'event_name') {
|
||||
filters.eventType = EVENT_TYPE.customEvent;
|
||||
}
|
||||
|
||||
return json(data);
|
||||
if (type === 'event') {
|
||||
return json(await getEventMetrics(websiteId, { type, limit, offset }, filters));
|
||||
} else {
|
||||
return json(await getPageviewMetrics(websiteId, { type, limit, offset }, filters));
|
||||
}
|
||||
}
|
||||
|
||||
if (type === 'channel') {
|
||||
const data = await getChannelMetrics(websiteId, filters);
|
||||
|
||||
return json(data);
|
||||
return json(await getChannelMetrics(websiteId, filters));
|
||||
}
|
||||
|
||||
return badRequest();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue