mirror of
https://github.com/umami-software/umami.git
synced 2026-02-09 15:17:23 +01:00
Updated roles and permissions logic.
This commit is contained in:
parent
4eb3140e43
commit
b57ecf33e6
63 changed files with 432 additions and 546 deletions
|
|
@ -3,7 +3,7 @@ import clickhouse from 'lib/clickhouse';
|
|||
import { runQuery, CLICKHOUSE, PRISMA } from 'lib/db';
|
||||
import cache from 'lib/cache';
|
||||
import { Prisma } from '@prisma/client';
|
||||
import { EventType } from 'lib/types';
|
||||
import { EVENT_TYPE } from 'lib/constants';
|
||||
|
||||
export async function getPageviewMetrics(
|
||||
...args: [
|
||||
|
|
@ -43,7 +43,7 @@ async function relationalQuery(
|
|||
${joinSession}
|
||||
where website_id='${websiteId}'
|
||||
and website_event.created_at between $1 and $2
|
||||
and event_type = ${EventType.Pageview}
|
||||
and event_type = ${EVENT_TYPE.pageView}
|
||||
${filterQuery}
|
||||
group by 1
|
||||
order by 2 desc`,
|
||||
|
|
@ -71,9 +71,9 @@ async function clickhouseQuery(
|
|||
from event
|
||||
where website_id = $1
|
||||
and rev_id = $2
|
||||
and event_type = ${EventType.Pageview}
|
||||
and event_type = ${EVENT_TYPE.pageView}
|
||||
${column !== 'event_name' ? `and event_name = ''` : `and event_name != ''`}
|
||||
and ${getBetweenDates('created_at', startDate, endDate)}
|
||||
and ${getBetweenDates('created_at', startDate, endDate)}n
|
||||
${filterQuery}
|
||||
group by x
|
||||
order by y desc`,
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
import { URL_LENGTH } from 'lib/constants';
|
||||
import { URL_LENGTH, EVENT_TYPE } from 'lib/constants';
|
||||
import { CLICKHOUSE, PRISMA, runQuery } from 'lib/db';
|
||||
import kafka from 'lib/kafka';
|
||||
import prisma from 'lib/prisma';
|
||||
import cache from 'lib/cache';
|
||||
import { uuid } from 'lib/crypto';
|
||||
import { EventType } from 'lib/types';
|
||||
|
||||
export async function savePageView(args: {
|
||||
id: string;
|
||||
|
|
@ -40,7 +39,7 @@ async function relationalQuery(data: {
|
|||
sessionId,
|
||||
url: url?.substring(0, URL_LENGTH),
|
||||
referrer: referrer?.substring(0, URL_LENGTH),
|
||||
eventType: EventType.Pageview,
|
||||
eventType: EVENT_TYPE.pageView,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
@ -58,7 +57,7 @@ async function clickhouseQuery(data) {
|
|||
rev_id: website?.revId || 0,
|
||||
created_at: getDateFormat(new Date()),
|
||||
country: country ? country : null,
|
||||
event_type: EventType.Pageview,
|
||||
event_type: EVENT_TYPE.pageView,
|
||||
...args,
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue