mirror of
https://github.com/umami-software/umami.git
synced 2026-02-09 07:07:17 +01:00
Added useFilterQuery. Converted websites and reports pages.
This commit is contained in:
parent
6846355c63
commit
7e626dcd52
29 changed files with 373 additions and 499 deletions
|
|
@ -1,11 +1,11 @@
|
|||
import { Prisma } from '@prisma/client';
|
||||
import prisma from '@umami/prisma-client';
|
||||
import moment from 'moment-timezone';
|
||||
import { MYSQL, POSTGRESQL, getDatabaseType } from 'lib/db';
|
||||
import { FILTER_COLUMNS, SESSION_COLUMNS, OPERATORS } from './constants';
|
||||
import { FILTER_COLUMNS, SESSION_COLUMNS, OPERATORS, DEFAULT_PAGE_SIZE } from './constants';
|
||||
import { loadWebsite } from './load';
|
||||
import { maxDate } from './date';
|
||||
import { QueryFilters, QueryOptions, SearchFilter } from './types';
|
||||
import { Prisma } from '@prisma/client';
|
||||
|
||||
const MYSQL_DATE_FORMATS = {
|
||||
minute: '%Y-%m-%d %H:%i:00',
|
||||
|
|
@ -171,7 +171,7 @@ async function rawQuery(sql: string, data: object): Promise<any> {
|
|||
return prisma.rawQuery(query, params);
|
||||
}
|
||||
|
||||
function getPageFilters(filters: SearchFilter<any>): [
|
||||
function getPageFilters(filters: SearchFilter): [
|
||||
{
|
||||
orderBy: {
|
||||
[x: string]: string;
|
||||
|
|
@ -185,7 +185,7 @@ function getPageFilters(filters: SearchFilter<any>): [
|
|||
orderBy: string;
|
||||
},
|
||||
] {
|
||||
const { pageSize = 10, page = 1, orderBy } = filters || {};
|
||||
const { page = 1, pageSize = DEFAULT_PAGE_SIZE, orderBy } = filters || {};
|
||||
|
||||
return [
|
||||
{
|
||||
|
|
@ -198,7 +198,7 @@ function getPageFilters(filters: SearchFilter<any>): [
|
|||
],
|
||||
}),
|
||||
},
|
||||
{ pageSize, page: +page, orderBy },
|
||||
{ page: +page, pageSize, orderBy },
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue