mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 04:37:11 +01:00
add subdivision1/2, cities to query logic
This commit is contained in:
parent
6bacfa5892
commit
55a586fe27
16 changed files with 184 additions and 57 deletions
|
|
@ -19,6 +19,9 @@ export interface NextApiRequestCollect extends NextApiRequest {
|
|||
screen: string;
|
||||
language: string;
|
||||
country: string;
|
||||
subdivision1: string;
|
||||
subdivision2: string;
|
||||
city: string;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,6 +46,9 @@ export interface WebsiteMetricsRequestQuery {
|
|||
browser: string;
|
||||
device: string;
|
||||
country: string;
|
||||
subdivision1: string;
|
||||
subdivision2: string;
|
||||
city: string;
|
||||
}
|
||||
|
||||
export default async (
|
||||
|
|
@ -66,6 +69,9 @@ export default async (
|
|||
browser,
|
||||
device,
|
||||
country,
|
||||
subdivision1,
|
||||
subdivision2,
|
||||
city,
|
||||
} = req.query;
|
||||
|
||||
if (req.method === 'GET') {
|
||||
|
|
@ -86,6 +92,9 @@ export default async (
|
|||
browser,
|
||||
device,
|
||||
country,
|
||||
subdivision1,
|
||||
subdivision2,
|
||||
city,
|
||||
},
|
||||
});
|
||||
|
||||
|
|
@ -131,6 +140,9 @@ export default async (
|
|||
browser: type !== 'browser' ? browser : undefined,
|
||||
device: type !== 'device' ? device : undefined,
|
||||
country: type !== 'country' ? country : undefined,
|
||||
subdivision1: type !== 'subdivision1' ? subdivision1 : undefined,
|
||||
subdivision2: type !== 'subdivision2' ? subdivision2 : undefined,
|
||||
city: type !== 'city' ? city : undefined,
|
||||
eventUrl: type !== 'url' && table === 'event' ? url : undefined,
|
||||
query: type === 'query' && table !== 'event' ? true : undefined,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -21,6 +21,9 @@ export interface WebsitePageviewRequestQuery {
|
|||
browser?: string;
|
||||
device?: string;
|
||||
country?: string;
|
||||
subdivision1?: string;
|
||||
subdivision2?: string;
|
||||
city?: string;
|
||||
}
|
||||
|
||||
export default async (
|
||||
|
|
@ -42,6 +45,9 @@ export default async (
|
|||
browser,
|
||||
device,
|
||||
country,
|
||||
subdivision1,
|
||||
subdivision2,
|
||||
city,
|
||||
} = req.query;
|
||||
|
||||
if (req.method === 'GET') {
|
||||
|
|
@ -70,6 +76,9 @@ export default async (
|
|||
browser,
|
||||
device,
|
||||
country,
|
||||
subdivision1,
|
||||
subdivision2,
|
||||
city,
|
||||
},
|
||||
}),
|
||||
getPageviewStats(websiteId, {
|
||||
|
|
@ -84,6 +93,9 @@ export default async (
|
|||
browser,
|
||||
device,
|
||||
country,
|
||||
subdivision1,
|
||||
subdivision2,
|
||||
city,
|
||||
},
|
||||
}),
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@ export interface WebsiteStatsRequestQuery {
|
|||
browser: string;
|
||||
device: string;
|
||||
country: string;
|
||||
subdivision1: string;
|
||||
subdivision2: string;
|
||||
city: string;
|
||||
}
|
||||
|
||||
export default async (
|
||||
|
|
@ -26,7 +29,20 @@ export default async (
|
|||
await useCors(req, res);
|
||||
await useAuth(req, res);
|
||||
|
||||
const { id: websiteId, startAt, endAt, url, referrer, os, browser, device, country } = req.query;
|
||||
const {
|
||||
id: websiteId,
|
||||
startAt,
|
||||
endAt,
|
||||
url,
|
||||
referrer,
|
||||
os,
|
||||
browser,
|
||||
device,
|
||||
country,
|
||||
subdivision1,
|
||||
subdivision2,
|
||||
city,
|
||||
} = req.query;
|
||||
|
||||
if (req.method === 'GET') {
|
||||
if (!(await canViewWebsite(req.auth, websiteId))) {
|
||||
|
|
@ -50,6 +66,9 @@ export default async (
|
|||
browser,
|
||||
device,
|
||||
country,
|
||||
subdivision1,
|
||||
subdivision2,
|
||||
city,
|
||||
},
|
||||
});
|
||||
const prevPeriod = await getWebsiteStats(websiteId, {
|
||||
|
|
@ -62,6 +81,9 @@ export default async (
|
|||
browser,
|
||||
device,
|
||||
country,
|
||||
subdivision1,
|
||||
subdivision2,
|
||||
city,
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue