Updated roles and permissions logic.

This commit is contained in:
Mike Cao 2022-12-06 18:36:41 -08:00
parent 4eb3140e43
commit b57ecf33e6
63 changed files with 432 additions and 546 deletions

View file

@ -2,7 +2,7 @@ import cache from 'lib/cache';
import clickhouse from 'lib/clickhouse';
import { CLICKHOUSE, PRISMA, runQuery } from 'lib/db';
import prisma from 'lib/prisma';
import { EventType } from 'lib/types';
import { EVENT_TYPE } from 'lib/constants';
export async function getPageviewStats(
...args: [
@ -56,7 +56,7 @@ async function relationalQuery(
${joinSession}
where website.website_id='${websiteId}'
and pageview.created_at between $1 and $2
and event_type = ${EventType.Pageview}
and event_type = ${EVENT_TYPE.pageView}
${filterQuery}
group by 1`,
params,
@ -92,7 +92,7 @@ async function clickhouseQuery(
from event
where website_id = $1
and rev_id = $2
and event_type = ${EventType.Pageview}
and event_type = ${EVENT_TYPE.pageView}
and ${getBetweenDates('created_at', startDate, endDate)}
${filterQuery}
group by t) g