mirror of
https://github.com/kremalicious/umami.git
synced 2025-01-24 09:13:42 +01:00
fixed relational query to get reset_at
This commit is contained in:
parent
cb79d806e8
commit
fbe35f4c97
@ -4,6 +4,7 @@ import { runQuery, CLICKHOUSE, PRISMA } from 'lib/db';
|
||||
import cache from 'lib/cache';
|
||||
import { WebsiteEventMetric } from 'lib/types';
|
||||
import { EVENT_TYPE } from 'lib/constants';
|
||||
import { getWebsite } from 'queries';
|
||||
|
||||
export async function getEventMetrics(
|
||||
...args: [
|
||||
@ -46,7 +47,7 @@ async function relationalQuery(
|
||||
},
|
||||
) {
|
||||
const { toUuid, rawQuery, getDateQuery, getFilterQuery } = prisma;
|
||||
const website = await cache.fetchWebsite(websiteId);
|
||||
const website = await getWebsite({ id: websiteId });
|
||||
const resetDate = website?.resetAt || website?.createdAt;
|
||||
const params: any = [websiteId, resetDate, startDate, endDate];
|
||||
|
||||
|
@ -3,6 +3,7 @@ import clickhouse from 'lib/clickhouse';
|
||||
import { CLICKHOUSE, PRISMA, runQuery } from 'lib/db';
|
||||
import prisma from 'lib/prisma';
|
||||
import { WebsiteEventDataMetric } from 'lib/types';
|
||||
import { getWebsite } from 'queries';
|
||||
|
||||
export async function getEventData(
|
||||
...args: [
|
||||
@ -48,7 +49,7 @@ async function relationalQuery(
|
||||
) {
|
||||
const { startDate, endDate, timeSeries, eventName, urlPath, filters } = data;
|
||||
const { toUuid, rawQuery, getEventDataFilterQuery, getDateQuery } = prisma;
|
||||
const website = await cache.fetchWebsite(websiteId);
|
||||
const website = await getWebsite({ id: websiteId });
|
||||
const resetDate = website?.resetAt || website?.createdAt;
|
||||
const params: any = [websiteId, resetDate, startDate, endDate, eventName || ''];
|
||||
|
||||
|
@ -4,6 +4,7 @@ import { runQuery, CLICKHOUSE, PRISMA } from 'lib/db';
|
||||
import cache from 'lib/cache';
|
||||
import { Prisma } from '@prisma/client';
|
||||
import { EVENT_TYPE } from 'lib/constants';
|
||||
import { getWebsite } from 'queries';
|
||||
|
||||
export async function getPageviewMetrics(
|
||||
...args: [
|
||||
@ -35,7 +36,7 @@ async function relationalQuery(
|
||||
) {
|
||||
const { startDate, endDate, column, filters = {}, type } = data;
|
||||
const { rawQuery, parseFilters, toUuid } = prisma;
|
||||
const website = await cache.fetchWebsite(websiteId);
|
||||
const website = await getWebsite({ id: websiteId });
|
||||
const resetDate = website?.resetAt || website?.createdAt;
|
||||
const params: any = [
|
||||
websiteId,
|
||||
|
@ -3,6 +3,7 @@ import clickhouse from 'lib/clickhouse';
|
||||
import { CLICKHOUSE, PRISMA, runQuery } from 'lib/db';
|
||||
import prisma from 'lib/prisma';
|
||||
import { EVENT_TYPE } from 'lib/constants';
|
||||
import { getWebsite } from 'queries';
|
||||
|
||||
export async function getPageviewStats(
|
||||
...args: [
|
||||
@ -46,7 +47,7 @@ async function relationalQuery(
|
||||
sessionKey = 'session_id',
|
||||
} = data;
|
||||
const { toUuid, getDateQuery, parseFilters, rawQuery } = prisma;
|
||||
const website = await cache.fetchWebsite(websiteId);
|
||||
const website = await getWebsite({ id: websiteId });
|
||||
const resetDate = website?.resetAt || website?.createdAt;
|
||||
const params: any = [websiteId, resetDate, startDate, endDate];
|
||||
const { filterQuery, joinSession } = parseFilters(filters, params);
|
||||
|
@ -3,6 +3,7 @@ import clickhouse from 'lib/clickhouse';
|
||||
import { runQuery, CLICKHOUSE, PRISMA } from 'lib/db';
|
||||
import cache from 'lib/cache';
|
||||
import { EVENT_TYPE } from 'lib/constants';
|
||||
import { getWebsite } from 'queries';
|
||||
|
||||
export async function getSessionMetrics(
|
||||
...args: [
|
||||
@ -20,7 +21,7 @@ async function relationalQuery(
|
||||
websiteId: string,
|
||||
data: { startDate: Date; endDate: Date; field: string; filters: object },
|
||||
) {
|
||||
const website = await cache.fetchWebsite(websiteId);
|
||||
const website = await getWebsite({ id: websiteId });
|
||||
const resetDate = website?.resetAt || website?.createdAt;
|
||||
const { startDate, endDate, field, filters = {} } = data;
|
||||
const { toUuid, parseFilters, rawQuery } = prisma;
|
||||
|
@ -3,6 +3,7 @@ import clickhouse from 'lib/clickhouse';
|
||||
import { runQuery, CLICKHOUSE, PRISMA } from 'lib/db';
|
||||
import cache from 'lib/cache';
|
||||
import { EVENT_TYPE } from 'lib/constants';
|
||||
import { getWebsite } from 'queries';
|
||||
|
||||
export async function getWebsiteStats(
|
||||
...args: [websiteId: string, data: { startDate: Date; endDate: Date; filters: object }]
|
||||
@ -19,7 +20,7 @@ async function relationalQuery(
|
||||
) {
|
||||
const { startDate, endDate, filters = {} } = data;
|
||||
const { toUuid, getDateQuery, getTimestampInterval, parseFilters, rawQuery } = prisma;
|
||||
const website = await cache.fetchWebsite(websiteId);
|
||||
const website = await getWebsite({ id: websiteId });
|
||||
const resetDate = website?.resetAt || website?.createdAt;
|
||||
const params: any = [websiteId, resetDate, startDate, endDate];
|
||||
const { filterQuery, joinSession } = parseFilters(filters, params);
|
||||
|
Loading…
Reference in New Issue
Block a user