mirror of
https://github.com/umami-software/umami.git
synced 2026-02-07 14:17:13 +01:00
v3 prisma queries update
This commit is contained in:
parent
61b667c587
commit
2ffde37f5b
21 changed files with 119 additions and 108 deletions
|
|
@ -21,20 +21,23 @@ async function relationalQuery(websiteId: string, sessionId: string, filters: Qu
|
|||
return rawQuery(
|
||||
`
|
||||
select
|
||||
created_at as createdAt,
|
||||
url_path as urlPath,
|
||||
url_query as urlQuery,
|
||||
referrer_domain as referrerDomain,
|
||||
event_id as eventId,
|
||||
event_type as eventType,
|
||||
event_name as eventName,
|
||||
visit_id as visitId,
|
||||
event_id IN (SELECT event_id FROM event_data) AS hasData
|
||||
from website_event e
|
||||
where e.website_id = {websiteId:UUID}
|
||||
and e.session_id = {sessionId:UUID}
|
||||
and e.created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
||||
order by e.created_at desc
|
||||
created_at as "createdAt",
|
||||
url_path as "urlPath",
|
||||
url_query as "urlQuery",
|
||||
referrer_domain as "referrerDomain",
|
||||
event_id as "eventId",
|
||||
event_type as "eventType",
|
||||
event_name as "eventName",
|
||||
visit_id as "visitId",
|
||||
event_id IN (select event_id
|
||||
from event_data
|
||||
where website_id = {{websiteId::uuid}}
|
||||
and session_id = {{sessionId::uuid}}) AS "hasData"
|
||||
from website_event
|
||||
where website_id = {{websiteId::uuid}}
|
||||
and session_id = {{sessionId::uuid}}
|
||||
and created_at between {{startDate}} and {{endDate}}
|
||||
order by created_at desc
|
||||
limit 500
|
||||
`,
|
||||
{ websiteId, sessionId, startDate, endDate },
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ async function relationalQuery(websiteId: string, filters: QueryFilters) {
|
|||
${joinSessionQuery}
|
||||
join session_data
|
||||
on session_data.session_id = website_event.session_id
|
||||
and session_data.website_id = website_event.website_id
|
||||
where website_event.website_id = {{websiteId::uuid}}
|
||||
and website_event.created_at between {{startDate}} and {{endDate}}
|
||||
${filterQuery}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ async function relationalQuery(
|
|||
${joinSessionQuery}
|
||||
join session_data
|
||||
on session_data.session_id = website_event.session_id
|
||||
and session_data.website_id = website_event.website_id
|
||||
where website_event.website_id = {{websiteId::uuid}}
|
||||
and website_event.created_at between {{startDate}} and {{endDate}}
|
||||
and session_data.data_key = {{propertyName}}
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ async function relationalQuery(
|
|||
from website_event
|
||||
${cohortQuery}
|
||||
join session on website_event.session_id = session.session_id
|
||||
and website_event.website_id = session.website_id
|
||||
where website_event.website_id = {{websiteId::uuid}}
|
||||
and website_event.created_at between {{startDate}} and {{endDate}}
|
||||
${filterQuery}
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ async function relationalQuery(websiteId: string, filters: QueryFilters) {
|
|||
from website_event
|
||||
${cohortQuery}
|
||||
join session on session.session_id = website_event.session_id
|
||||
and session.website_id = website_event.website_id
|
||||
where website_event.website_id = {{websiteId::uuid}}
|
||||
${dateQuery}
|
||||
${filterQuery}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue