mirror of
https://github.com/umami-software/umami.git
synced 2026-02-10 07:37:11 +01:00
Add Reset / Delete functionality.
This commit is contained in:
parent
4f098a34c1
commit
30743feb0e
6 changed files with 26 additions and 29 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import prisma from 'lib/prisma';
|
||||
import clickhouse from 'lib/clickhouse';
|
||||
import { runQuery, CLICKHOUSE, PRISMA } from 'lib/db';
|
||||
import cache from 'lib/cache';
|
||||
|
||||
export async function getWebsiteStats(...args) {
|
||||
return runQuery({
|
||||
|
|
@ -45,7 +46,8 @@ async function relationalQuery(websiteId, { start_at, end_at, filters = {} }) {
|
|||
|
||||
async function clickhouseQuery(websiteId, { start_at, end_at, filters = {} }) {
|
||||
const { rawQuery, getDateQuery, getBetweenDates, parseFilters } = clickhouse;
|
||||
const params = [websiteId];
|
||||
const website = await cache.fetchWebsite(websiteId);
|
||||
const params = [websiteId, website?.revId || 0];
|
||||
const { pageviewQuery, sessionQuery } = parseFilters(null, filters, params);
|
||||
|
||||
return rawQuery(
|
||||
|
|
@ -63,6 +65,7 @@ async function clickhouseQuery(websiteId, { start_at, end_at, filters = {} }) {
|
|||
from event
|
||||
where event_name = ''
|
||||
and website_id = $1
|
||||
and rev_id = $2
|
||||
and ${getBetweenDates('created_at', start_at, end_at)}
|
||||
${pageviewQuery}
|
||||
${sessionQuery}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue