fix websiteEvent query

This commit is contained in:
Francis Cao 2024-08-20 13:57:40 -07:00
parent 8ee4fc32fd
commit adc65e4487

View File

@ -15,13 +15,22 @@ export function getWebsiteEvents(
async function relationalQuery(websiteId: string, filters: QueryFilters, pageParams?: PageParams) {
const { pagedQuery } = prisma;
const { query } = pageParams;
const { startDate, endDate } = filters;
const where = {
id: websiteId,
websiteId,
createdAt: {
lte: endDate,
gte: startDate,
},
...prisma.getSearchParameters(query, [{ eventName: 'contains' }, { urlPath: 'contains' }]),
};
return pagedQuery('WebsiteEvent', { where }, pageParams);
return pagedQuery(
'websiteEvent',
{ where },
{ orderBy: 'createdAt', sortDescending: true, ...pageParams },
);
}
async function clickhouseQuery(websiteId: string, filters: QueryFilters, pageParams?: PageParams) {