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

+4 -4
View File
@@ -22,8 +22,8 @@ async function relationalQuery(websiteId: string, filters: QueryFilters) {
});
const searchQuery = search
? `and ((event_name ilike {{search}} and event_type = 2)
or (url_path ilike {{search}} and event_type = 1))`
? `and ((event_name ilike {{search}} and event_type = ${EVENT_TYPE.customEvent})
or (url_path ilike {{search}} and event_type = ${EVENT_TYPE.pageView}))`
: '';
return pagedRawQuery(
@@ -77,8 +77,8 @@ async function clickhouseQuery(websiteId: string, filters: QueryFilters) {
});
const searchQuery = search
? `and ((positionCaseInsensitive(event_name, {search:String}) > 0 and event_type = 2)
or (positionCaseInsensitive(url_path, {search:String}) > 0 and event_type = 1))`
? `and ((positionCaseInsensitive(event_name, {search:String}) > 0 and event_type = ${EVENT_TYPE.customEvent})
or (positionCaseInsensitive(url_path, {search:String}) > 0 and event_type = ${EVENT_TYPE.pageView}))`
: '';
return pagedRawQuery(