refactor(queries): replace hardcoded event types with constants

Replaced hardcoded `event_type` values with named constants from
`EVENT_TYPE`, as in #3614. Added the `BOUNCE_THRESHOLD` constant and
documented it in `docker-compose.yml`.
This commit is contained in:
Federico D'Eredità committed 2026-07-26 18:49:58 +02:00
1 parent 9b41053d47
commit 19fcde2c9c
6 files changed
+20 -15

No files matched your search

@@ -49,8 +49,8 @@ async function relationalQuery(websiteId: string, sessionId: string) {
session.city,
min(website_event.created_at) as min_time,
max(website_event.created_at) as max_time,
sum(case when website_event.event_type = 1 then 1 else 0 end) as views,
sum(case when website_event.event_type = 2 then 1 else 0 end) as events
sum(case when website_event.event_type = ${EVENT_TYPE.pageView} then 1 else 0 end) as views,
sum(case when website_event.event_type = ${EVENT_TYPE.customEvent} then 1 else 0 end) as events
from session
join website_event on website_event.session_id = session.session_id
where session.website_id = {{websiteId::uuid}}