mirror of
https://github.com/kremalicious/umami.git
synced 2025-02-01 12:29:35 +01:00
add normalize filters to clickhouse
This commit is contained in:
parent
d6c8f3aa18
commit
146650586b
@ -94,13 +94,23 @@ function getFilterQuery(filters: QueryFilters = {}, options: QueryOptions = {})
|
|||||||
return query.join('\n');
|
return query.join('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function normalizeFilters(filters = {}) {
|
||||||
|
return Object.keys(filters).reduce((obj, key) => {
|
||||||
|
const value = filters[key];
|
||||||
|
|
||||||
|
obj[key] = value?.value ?? value;
|
||||||
|
|
||||||
|
return obj;
|
||||||
|
}, {});
|
||||||
|
}
|
||||||
|
|
||||||
async function parseFilters(websiteId: string, filters: QueryFilters = {}, options?: QueryOptions) {
|
async function parseFilters(websiteId: string, filters: QueryFilters = {}, options?: QueryOptions) {
|
||||||
const website = await loadWebsite(websiteId);
|
const website = await loadWebsite(websiteId);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
filterQuery: getFilterQuery(filters, options),
|
filterQuery: getFilterQuery(filters, options),
|
||||||
params: {
|
params: {
|
||||||
...filters,
|
...normalizeFilters(filters),
|
||||||
websiteId,
|
websiteId,
|
||||||
startDate: maxDate(filters.startDate, website.resetAt),
|
startDate: maxDate(filters.startDate, website.resetAt),
|
||||||
websiteDomain: website.domain,
|
websiteDomain: website.domain,
|
||||||
|
Loading…
Reference in New Issue
Block a user