click subpath
This commit is contained in:
@@ -22,6 +22,7 @@ export interface EventsQueryParams {
|
||||
teamIds?: string[];
|
||||
projectIds?: string[];
|
||||
tagIds?: string[];
|
||||
subpath?: string;
|
||||
page?: number;
|
||||
pageSize?: number;
|
||||
sortBy?: string;
|
||||
@@ -66,6 +67,7 @@ export async function getEventsSummary(params: {
|
||||
teamIds?: string[];
|
||||
projectIds?: string[];
|
||||
tagIds?: string[];
|
||||
subpath?: string;
|
||||
}): Promise<EventsSummary> {
|
||||
console.log('getEventsSummary received params:', params);
|
||||
const filter = buildFilter(params);
|
||||
@@ -186,6 +188,7 @@ export async function getTimeSeriesData(params: {
|
||||
teamIds?: string[];
|
||||
projectIds?: string[];
|
||||
tagIds?: string[];
|
||||
subpath?: string;
|
||||
}): Promise<TimeSeriesData[]> {
|
||||
const filter = buildFilter(params);
|
||||
|
||||
@@ -221,6 +224,7 @@ export async function getGeoAnalytics(params: {
|
||||
teamIds?: string[];
|
||||
projectIds?: string[];
|
||||
tagIds?: string[];
|
||||
subpath?: string;
|
||||
}): Promise<GeoData[]> {
|
||||
const filter = buildFilter(params);
|
||||
|
||||
@@ -257,6 +261,7 @@ export async function getDeviceAnalytics(params: {
|
||||
teamIds?: string[];
|
||||
projectIds?: string[];
|
||||
tagIds?: string[];
|
||||
subpath?: string;
|
||||
}): Promise<DeviceAnalytics> {
|
||||
const filter = buildFilter(params);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createClient } from '@clickhouse/client';
|
||||
import type { EventsQueryParams } from './types';
|
||||
import { EventsQueryParams } from './analytics';
|
||||
|
||||
// ClickHouse 客户端配置
|
||||
const clickhouse = createClient({
|
||||
@@ -58,6 +58,13 @@ export function buildFilter(params: Partial<EventsQueryParams>): string {
|
||||
filters.push(`user_id = '${params.userId}'`);
|
||||
}
|
||||
|
||||
// 添加子路径过滤条件
|
||||
if (params.subpath) {
|
||||
console.log('Adding subpath filter:', params.subpath);
|
||||
// 使用 url 字段和字符串函数替代不存在的 path 字段
|
||||
filters.push(`positionCaseInsensitive(url, '/${params.subpath}') > 0`);
|
||||
}
|
||||
|
||||
// 添加团队ID过滤条件
|
||||
if (params.teamId) {
|
||||
filters.push(`team_id = '${params.teamId}'`);
|
||||
|
||||
Reference in New Issue
Block a user