mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-10 07:48:37 +01:00
[NOT READY] fix dates + charts + ui
This commit is contained in:
@@ -7,7 +7,7 @@ export default defineEventHandler(async event => {
|
||||
const data = await getRequestData(event, { requireSchema: false, requireSlice: true });
|
||||
if (!data) return;
|
||||
|
||||
const { pid, from, to, slice, project_id } = data;
|
||||
const { pid, from, to, slice, project_id, timeOffset } = data;
|
||||
|
||||
const cacheKey = `timeline:events:${pid}:${slice}:${from}:${to}`;
|
||||
const cacheExp = 60;
|
||||
@@ -16,7 +16,7 @@ export default defineEventHandler(async event => {
|
||||
const timelineData = await executeTimelineAggregation({
|
||||
projectId: project_id,
|
||||
model: EventModel,
|
||||
from, to, slice
|
||||
from, to, slice, timeOffset
|
||||
});
|
||||
return timelineData;
|
||||
});
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { EventModel } from "@schema/metrics/EventSchema";
|
||||
import { Redis, TIMELINE_EXPIRE_TIME } from "~/server/services/CacheService";
|
||||
import { executeAdvancedTimelineAggregation} from "~/server/services/TimelineService";
|
||||
import { executeAdvancedTimelineAggregation } from "~/server/services/TimelineService";
|
||||
|
||||
export default defineEventHandler(async event => {
|
||||
|
||||
const data = await getRequestData(event, { requireSchema: false, requireSlice: true });
|
||||
if (!data) return;
|
||||
|
||||
const { from, to, slice, project_id } = data;
|
||||
const { from, to, slice, project_id, timeOffset } = data;
|
||||
|
||||
return await Redis.useCache({ key: `timeline:events_stacked:${project_id}:${slice}:${from || 'none'}:${to || 'none'}`, exp: TIMELINE_EXPIRE_TIME }, async () => {
|
||||
|
||||
@@ -17,6 +17,7 @@ export default defineEventHandler(async event => {
|
||||
from, to, slice,
|
||||
customProjection: { name: "$_id.name" },
|
||||
customIdGroup: { name: '$name' },
|
||||
timeOffset
|
||||
})
|
||||
|
||||
return timelineStackedEvents;
|
||||
|
||||
@@ -7,7 +7,7 @@ export default defineEventHandler(async event => {
|
||||
const data = await getRequestData(event, { requireSchema: false, requireSlice: true });
|
||||
if (!data) return;
|
||||
|
||||
const { pid, from, to, slice, project_id } = data;
|
||||
const { pid, from, to, slice, project_id, timeOffset } = data;
|
||||
|
||||
const cacheKey = `timeline:sessions:${pid}:${slice}:${from}:${to}`;
|
||||
const cacheExp = 60;
|
||||
@@ -16,7 +16,7 @@ export default defineEventHandler(async event => {
|
||||
const timelineData = await executeTimelineAggregation({
|
||||
projectId: project_id,
|
||||
model: SessionModel,
|
||||
from, to, slice,
|
||||
from, to, slice, timeOffset
|
||||
});
|
||||
return timelineData;
|
||||
});
|
||||
|
||||
@@ -7,7 +7,7 @@ export default defineEventHandler(async event => {
|
||||
const data = await getRequestData(event, { requireSchema: false, requireSlice: true });
|
||||
if (!data) return;
|
||||
|
||||
const { pid, from, to, slice, project_id } = data;
|
||||
const { pid, from, to, slice, project_id, timeOffset } = data;
|
||||
|
||||
const cacheKey = `timeline:sessions_duration:${pid}:${slice}:${from}:${to}`;
|
||||
const cacheExp = 60;
|
||||
|
||||
@@ -7,7 +7,7 @@ export default defineEventHandler(async event => {
|
||||
const data = await getRequestData(event, { requireSchema: false, requireSlice: true });
|
||||
if (!data) return;
|
||||
|
||||
const { pid, from, to, slice, project_id } = data;
|
||||
const { pid, from, to, slice, project_id, timeOffset } = data;
|
||||
|
||||
const cacheKey = `timeline:visits:${pid}:${slice}:${from}:${to}`;
|
||||
const cacheExp = 60;
|
||||
@@ -16,7 +16,7 @@ export default defineEventHandler(async event => {
|
||||
const timelineData = await executeTimelineAggregation({
|
||||
projectId: project_id,
|
||||
model: VisitModel,
|
||||
from, to, slice
|
||||
from, to, slice, timeOffset
|
||||
});
|
||||
return timelineData;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user