Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Mike Cao 2023-10-16 21:56:09 -07:00
commit 4c57c32950

View File

@ -8,7 +8,11 @@ export function getEventUsage(...args: [websiteIds: string[], startDate: Date, e
}); });
} }
function clickhouseQuery(websiteIds: string[], startDate: Date, endDate: Date) { function clickhouseQuery(
websiteIds: string[],
startDate: Date,
endDate: Date,
): Promise<{ websiteId: string; count: number }[]> {
const { rawQuery } = clickhouse; const { rawQuery } = clickhouse;
return rawQuery( return rawQuery(
@ -26,5 +30,9 @@ function clickhouseQuery(websiteIds: string[], startDate: Date, endDate: Date) {
startDate, startDate,
endDate, endDate,
}, },
); ).then(a => {
return Object.values(a).map(a => {
return { websiteId: a.websiteId, count: Number(a.count) };
});
});
} }