mirror of
https://github.com/umami-software/umami.git
synced 2026-02-07 14:17:13 +01:00
Added limit to metrics queries.
This commit is contained in:
parent
a851ebf124
commit
907685b96e
7 changed files with 32 additions and 12 deletions
|
|
@ -25,6 +25,7 @@ export interface WebsiteMetricsRequestQuery {
|
|||
city?: string;
|
||||
language?: string;
|
||||
event?: string;
|
||||
limit?: number;
|
||||
}
|
||||
|
||||
const schema = {
|
||||
|
|
@ -45,6 +46,7 @@ const schema = {
|
|||
city: yup.string(),
|
||||
language: yup.string(),
|
||||
event: yup.string(),
|
||||
limit: yup.number(),
|
||||
}),
|
||||
};
|
||||
|
||||
|
|
@ -71,6 +73,7 @@ export default async (
|
|||
city,
|
||||
language,
|
||||
event,
|
||||
limit,
|
||||
} = req.query;
|
||||
|
||||
if (req.method === 'GET') {
|
||||
|
|
@ -100,7 +103,7 @@ export default async (
|
|||
const column = FILTER_COLUMNS[type] || type;
|
||||
|
||||
if (SESSION_COLUMNS.includes(type)) {
|
||||
const data = await getSessionMetrics(websiteId, column, filters);
|
||||
const data = await getSessionMetrics(websiteId, column, filters, limit);
|
||||
|
||||
if (type === 'language') {
|
||||
const combined = {};
|
||||
|
|
@ -122,7 +125,7 @@ export default async (
|
|||
}
|
||||
|
||||
if (EVENT_COLUMNS.includes(type)) {
|
||||
const data = await getPageviewMetrics(websiteId, column, filters);
|
||||
const data = await getPageviewMetrics(websiteId, column, filters, limit);
|
||||
|
||||
return ok(res, data);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue