mirror of
https://github.com/umami-software/umami.git
synced 2026-02-12 08:37:13 +01:00
WebsiteId query param. Fix Prisma filters.
This commit is contained in:
parent
f654e6728c
commit
b4bd988e4e
10 changed files with 62 additions and 46 deletions
|
|
@ -38,23 +38,23 @@ async function relationalQuery(
|
|||
},
|
||||
) {
|
||||
const { startDate, endDate, eventName, columns, filters } = data;
|
||||
const { rawQuery, getEventDataColumnsQuery, getEventDataFilterQuery } = prisma;
|
||||
const params = [startDate, endDate];
|
||||
const { toUuid, rawQuery, getEventDataColumnsQuery, getEventDataFilterQuery } = prisma;
|
||||
const params: any = [websiteId, startDate, endDate, eventName];
|
||||
|
||||
return rawQuery(
|
||||
`select
|
||||
${getEventDataColumnsQuery('event_data', columns)}
|
||||
from website_event
|
||||
where website_id ='${websiteId}'
|
||||
and created_at between $1 and $2
|
||||
where website_id = $1${toUuid()}
|
||||
and created_at between $2 and $3
|
||||
and event_type = ${EVENT_TYPE.customEvent}
|
||||
${eventName ? `and eventName = ${eventName}` : ''}
|
||||
${eventName ? `and eventName = $4` : ''}
|
||||
${
|
||||
Object.keys(filters).length > 0
|
||||
? `and ${getEventDataFilterQuery('event_data', filters)}`
|
||||
: ''
|
||||
}`,
|
||||
params as any,
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue