mirror of
https://github.com/umami-software/umami.git
synced 2026-02-13 00:55:37 +01:00
Refactored queries.
This commit is contained in:
parent
f36a689817
commit
8904b7b4ed
27 changed files with 137 additions and 144 deletions
|
|
@ -52,19 +52,14 @@ export default async (
|
|||
return unauthorized(res);
|
||||
}
|
||||
|
||||
const result = await updateReport(
|
||||
{
|
||||
websiteId,
|
||||
userId,
|
||||
type,
|
||||
name,
|
||||
description,
|
||||
parameters: JSON.stringify(parameters),
|
||||
} as any,
|
||||
{
|
||||
id: reportId,
|
||||
},
|
||||
);
|
||||
const result = await updateReport(reportId, {
|
||||
websiteId,
|
||||
userId,
|
||||
type,
|
||||
name,
|
||||
description,
|
||||
parameters: JSON.stringify(parameters),
|
||||
} as any);
|
||||
|
||||
return ok(res, result);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import { useAuth, useCors } from 'lib/middleware';
|
|||
import { NextApiRequestQueryBody } from 'lib/types';
|
||||
import { NextApiResponse } from 'next';
|
||||
import { methodNotAllowed, ok, unauthorized } from 'next-basics';
|
||||
import { createReport, getReports } from 'queries';
|
||||
import { createReport, getWebsiteReports } from 'queries';
|
||||
import { canViewWebsite } from 'lib/auth';
|
||||
import { uuid } from 'lib/crypto';
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ export default async (
|
|||
return unauthorized(res);
|
||||
}
|
||||
|
||||
const data = await getReports({ websiteId });
|
||||
const data = await getWebsiteReports(websiteId);
|
||||
|
||||
return ok(res, data);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue