mirror of
https://github.com/umami-software/umami.git
synced 2026-02-10 07:37:11 +01:00
Converted reports and share routes.
This commit is contained in:
parent
dcac7b7c96
commit
6c9f1ad06b
23 changed files with 574 additions and 5 deletions
|
|
@ -243,7 +243,7 @@ async function pagedQuery<T>(model: string, criteria: T, pageParams: PageParams)
|
|||
const data = await prisma.client[model].findMany({
|
||||
...criteria,
|
||||
...{
|
||||
...(size > 0 && { take: +size, skip: +size * (page - 1) }),
|
||||
...(size > 0 && { take: +size, skip: +size * (+page - 1) }),
|
||||
...(orderBy && {
|
||||
orderBy: [
|
||||
{
|
||||
|
|
@ -266,7 +266,7 @@ async function pagedRawQuery(
|
|||
) {
|
||||
const { page = 1, pageSize, orderBy, sortDescending = false } = pageParams;
|
||||
const size = +pageSize || DEFAULT_PAGE_SIZE;
|
||||
const offset = +size * (page - 1);
|
||||
const offset = +size * (+page - 1);
|
||||
const direction = sortDescending ? 'desc' : 'asc';
|
||||
|
||||
const statements = [
|
||||
|
|
|
|||
|
|
@ -30,7 +30,17 @@ export const unitParam = z.string().refine(value => UNIT_TYPES.includes(value),
|
|||
message: 'Invalid unit',
|
||||
});
|
||||
|
||||
export const roleParam = z.string().regex(/team-member|team-view-only|team-manager/);
|
||||
export const roleParam = z.enum(['team-member', 'team-view-only', 'team-manager']);
|
||||
|
||||
export const reportTypeParam = z.enum([
|
||||
'funnel',
|
||||
'insights',
|
||||
'retention',
|
||||
'utm',
|
||||
'goals',
|
||||
'journey',
|
||||
'revenue',
|
||||
]);
|
||||
|
||||
export const filterParams = {
|
||||
url: z.string().optional(),
|
||||
|
|
|
|||
|
|
@ -26,8 +26,8 @@ export type ReportType = ObjectValues<typeof REPORT_TYPES>;
|
|||
|
||||
export interface PageParams {
|
||||
search?: string;
|
||||
page?: number;
|
||||
pageSize?: number;
|
||||
page?: string;
|
||||
pageSize?: string;
|
||||
orderBy?: string;
|
||||
sortDescending?: boolean;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue