mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-09 23:48:36 +01:00
refactoring dashboard
This commit is contained in:
@@ -1,22 +1,22 @@
|
||||
import { SessionModel } from "@schema/metrics/SessionSchema";
|
||||
import { Redis } from "~/server/services/CacheService";
|
||||
import { executeTimelineAggregation, fillAndMergeTimelineAggregationV2 } from "~/server/services/TimelineService";
|
||||
import { executeTimelineAggregation } from "~/server/services/TimelineService";
|
||||
|
||||
export default defineEventHandler(async event => {
|
||||
|
||||
const data = await getRequestDataOld(event, { requireSchema: false, requireSlice: true });
|
||||
const data = await getRequestData(event, ['SLICE', 'GUEST', 'DOMAIN', 'RANGE', 'OFFSET']);
|
||||
if (!data) return;
|
||||
|
||||
const { pid, from, to, slice, project_id, timeOffset } = data;
|
||||
const { pid, from, to, slice, project_id, timeOffset, domain } = data;
|
||||
|
||||
const cacheKey = `timeline:sessions:${pid}:${slice}:${from}:${to}`;
|
||||
const cacheKey = `timeline:sessions:${pid}:${slice}:${from}:${to}:${domain}`;
|
||||
const cacheExp = 60;
|
||||
|
||||
return await Redis.useCacheV2(cacheKey, cacheExp, async () => {
|
||||
const timelineData = await executeTimelineAggregation({
|
||||
projectId: project_id,
|
||||
model: SessionModel,
|
||||
from, to, slice, timeOffset
|
||||
from, to, slice, timeOffset, domain
|
||||
});
|
||||
return timelineData;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user