mirror of
https://github.com/kremalicious/umami.git
synced 2025-02-01 12:29:35 +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 = '') {
|
||||
const db = getDatabaseType();
|
||||
const like = db === POSTGRESQL ? 'ilike' : 'like';
|
||||
@ -253,6 +260,7 @@ export default {
|
||||
getFilterQuery,
|
||||
getSearchParameters,
|
||||
getTimestampDiffQuery,
|
||||
getSearchQuery,
|
||||
getQueryMode,
|
||||
pagedQuery,
|
||||
parseFilters,
|
||||
|
@ -18,11 +18,11 @@ async function relationalQuery(
|
||||
endDate: Date,
|
||||
search: string,
|
||||
) {
|
||||
const { rawQuery } = prisma;
|
||||
const { rawQuery, getSearchQuery } = prisma;
|
||||
let searchQuery = '';
|
||||
|
||||
if (search) {
|
||||
searchQuery = `and ${column} LIKE {{search}}`;
|
||||
searchQuery = getSearchQuery(column);
|
||||
}
|
||||
|
||||
return rawQuery(
|
||||
|
@ -43,10 +43,8 @@ async function relationalQuery(
|
||||
min(website_event.created_at) as "min_time",
|
||||
max(website_event.created_at) as "max_time"
|
||||
from website_event
|
||||
join website
|
||||
on website_event.website_id = website.website_id
|
||||
${joinSession}
|
||||
where website.website_id = {{websiteId::uuid}}
|
||||
where website_event.website_id = {{websiteId::uuid}}
|
||||
and website_event.created_at between {{startDate}} and {{endDate}}
|
||||
and event_type = {{eventType}}
|
||||
${filterQuery}
|
||||
|
Loading…
Reference in New Issue
Block a user