mirror of
https://github.com/kremalicious/umami.git
synced 2025-02-14 21:10:34 +01:00
Merge branch 'dev' of https://github.com/umami-software/umami into dev
This commit is contained in:
commit
15a3cc2e1e
@ -93,6 +93,13 @@ function getTimestampDiffQuery(field1: string, field2: string): string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getSearchQuery(column: string): string {
|
||||||
|
const db = getDatabaseType();
|
||||||
|
const like = db === POSTGRESQL ? 'ilike' : 'like';
|
||||||
|
|
||||||
|
return `and ${column} ${like} {{search}}`;
|
||||||
|
}
|
||||||
|
|
||||||
function mapFilter(column: string, operator: string, name: string, type: string = '') {
|
function mapFilter(column: string, operator: string, name: string, type: string = '') {
|
||||||
const db = getDatabaseType();
|
const db = getDatabaseType();
|
||||||
const like = db === POSTGRESQL ? 'ilike' : 'like';
|
const like = db === POSTGRESQL ? 'ilike' : 'like';
|
||||||
@ -253,6 +260,7 @@ export default {
|
|||||||
getFilterQuery,
|
getFilterQuery,
|
||||||
getSearchParameters,
|
getSearchParameters,
|
||||||
getTimestampDiffQuery,
|
getTimestampDiffQuery,
|
||||||
|
getSearchQuery,
|
||||||
getQueryMode,
|
getQueryMode,
|
||||||
pagedQuery,
|
pagedQuery,
|
||||||
parseFilters,
|
parseFilters,
|
||||||
|
@ -18,11 +18,11 @@ async function relationalQuery(
|
|||||||
endDate: Date,
|
endDate: Date,
|
||||||
search: string,
|
search: string,
|
||||||
) {
|
) {
|
||||||
const { rawQuery } = prisma;
|
const { rawQuery, getSearchQuery } = prisma;
|
||||||
let searchQuery = '';
|
let searchQuery = '';
|
||||||
|
|
||||||
if (search) {
|
if (search) {
|
||||||
searchQuery = `and ${column} LIKE {{search}}`;
|
searchQuery = getSearchQuery(column);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rawQuery(
|
return rawQuery(
|
||||||
|
@ -43,10 +43,8 @@ async function relationalQuery(
|
|||||||
min(website_event.created_at) as "min_time",
|
min(website_event.created_at) as "min_time",
|
||||||
max(website_event.created_at) as "max_time"
|
max(website_event.created_at) as "max_time"
|
||||||
from website_event
|
from website_event
|
||||||
join website
|
|
||||||
on website_event.website_id = website.website_id
|
|
||||||
${joinSession}
|
${joinSession}
|
||||||
where website.website_id = {{websiteId::uuid}}
|
where website_event.website_id = {{websiteId::uuid}}
|
||||||
and website_event.created_at between {{startDate}} and {{endDate}}
|
and website_event.created_at between {{startDate}} and {{endDate}}
|
||||||
and event_type = {{eventType}}
|
and event_type = {{eventType}}
|
||||||
${filterQuery}
|
${filterQuery}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user