mirror of
https://github.com/kremalicious/umami.git
synced 2025-02-07 01:45:43 +01:00
43 lines
810 B
TypeScript
43 lines
810 B
TypeScript
|
import { CLICKHOUSE, PRISMA, runQuery } from 'lib/db';
|
||
|
import prisma from 'lib/prisma';
|
||
|
import clickhouse from 'lib/clickhouse';
|
||
|
|
||
|
export interface GetInsightsCriteria {
|
||
|
startDate: Date;
|
||
|
endDate: Date;
|
||
|
fields: string[];
|
||
|
filters: string[];
|
||
|
groups: string[];
|
||
|
}
|
||
|
|
||
|
export async function getInsights(...args: [websiteId: string, criteria: GetInsightsCriteria]) {
|
||
|
return runQuery({
|
||
|
[PRISMA]: () => relationalQuery(...args),
|
||
|
[CLICKHOUSE]: () => clickhouseQuery(...args),
|
||
|
});
|
||
|
}
|
||
|
|
||
|
async function relationalQuery(
|
||
|
websiteId: string,
|
||
|
criteria: GetInsightsCriteria,
|
||
|
): Promise<
|
||
|
{
|
||
|
x: string;
|
||
|
y: number;
|
||
|
}[]
|
||
|
> {
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
async function clickhouseQuery(
|
||
|
websiteId: string,
|
||
|
criteria: GetInsightsCriteria,
|
||
|
): Promise<
|
||
|
{
|
||
|
x: string;
|
||
|
y: number;
|
||
|
}[]
|
||
|
> {
|
||
|
return null;
|
||
|
}
|