mirror of
https://github.com/umami-software/umami.git
synced 2026-02-10 23:57:12 +01:00
Update report parameters.
This commit is contained in:
parent
e9b0d3f796
commit
43f5854f15
5 changed files with 27 additions and 20 deletions
|
|
@ -40,6 +40,9 @@ export default async (
|
|||
|
||||
if (req.method === 'POST') {
|
||||
const { id: reportId } = req.query;
|
||||
const {
|
||||
user: { id: userId },
|
||||
} = req.auth;
|
||||
|
||||
const { websiteId, type, name, description, parameters } = req.body;
|
||||
|
||||
|
|
@ -52,6 +55,7 @@ export default async (
|
|||
const result = await updateReport(
|
||||
{
|
||||
websiteId,
|
||||
userId,
|
||||
type,
|
||||
name,
|
||||
description,
|
||||
|
|
|
|||
|
|
@ -9,8 +9,10 @@ export interface FunnelRequestBody {
|
|||
websiteId: string;
|
||||
urls: string[];
|
||||
window: number;
|
||||
startAt: number;
|
||||
endAt: number;
|
||||
dateRange: {
|
||||
startDate: string;
|
||||
endDate: string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface FunnelResponse {
|
||||
|
|
@ -28,18 +30,20 @@ export default async (
|
|||
await useAuth(req, res);
|
||||
|
||||
if (req.method === 'POST') {
|
||||
const { websiteId, urls, window, startAt, endAt } = req.body;
|
||||
const {
|
||||
websiteId,
|
||||
urls,
|
||||
window,
|
||||
dateRange: { startDate, endDate },
|
||||
} = req.body;
|
||||
|
||||
if (!(await canViewWebsite(req.auth, websiteId))) {
|
||||
return unauthorized(res);
|
||||
}
|
||||
|
||||
const startDate = new Date(+startAt);
|
||||
const endDate = new Date(+endAt);
|
||||
|
||||
const data = await getPageviewFunnel(websiteId, {
|
||||
startDate,
|
||||
endDate,
|
||||
startDate: new Date(startDate),
|
||||
endDate: new Date(endDate),
|
||||
urls,
|
||||
windowMinutes: +window,
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue