mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-10 07:48:37 +01:00
add domain filter on events
This commit is contained in:
@@ -16,7 +16,7 @@ export default defineEventHandler(async event => {
|
||||
const timelineData = await executeTimelineAggregation({
|
||||
projectId: project_id,
|
||||
model: EventModel,
|
||||
from, to, slice, timeOffset, domain, debug: true
|
||||
from, to, slice, timeOffset, domain
|
||||
});
|
||||
return timelineData;
|
||||
});
|
||||
|
||||
@@ -4,12 +4,12 @@ import { executeAdvancedTimelineAggregation } from "~/server/services/TimelineSe
|
||||
|
||||
export default defineEventHandler(async event => {
|
||||
|
||||
const data = await getRequestDataOld(event, { requireSchema: false, requireSlice: true });
|
||||
const data = await getRequestData(event, ['GUEST', 'RANGE', 'SLICE', 'DOMAIN']);
|
||||
if (!data) return;
|
||||
|
||||
const { from, to, slice, project_id, timeOffset } = data;
|
||||
const { from, to, slice, project_id, timeOffset, domain } = data;
|
||||
|
||||
return await Redis.useCache({ key: `timeline:events_stacked:${project_id}:${slice}:${from || 'none'}:${to || 'none'}`, exp: TIMELINE_EXPIRE_TIME }, async () => {
|
||||
return await Redis.useCache({ key: `timeline:events_stacked:${project_id}:${slice}:${from || 'none'}:${to || 'none'}:${domain}`, exp: TIMELINE_EXPIRE_TIME }, async () => {
|
||||
|
||||
const timelineStackedEvents = await executeAdvancedTimelineAggregation<{ name: String }>({
|
||||
model: EventModel,
|
||||
@@ -17,7 +17,8 @@ export default defineEventHandler(async event => {
|
||||
from, to, slice,
|
||||
customProjection: { name: "$_id.name" },
|
||||
customIdGroup: { name: '$name' },
|
||||
timeOffset
|
||||
timeOffset,
|
||||
domain
|
||||
})
|
||||
|
||||
return timelineStackedEvents;
|
||||
|
||||
@@ -10,13 +10,14 @@ export default defineEventHandler(async event => {
|
||||
const { pid, from, to, slice, project_id, timeOffset, domain } = data;
|
||||
|
||||
const cacheKey = `timeline:visits:${pid}:${slice}:${from}:${to}:${domain}`;
|
||||
const cacheExp = 60;
|
||||
const cacheExp = 20;
|
||||
|
||||
return await Redis.useCacheV2(cacheKey, cacheExp, async () => {
|
||||
const timelineData = await executeAdvancedTimelineAggregation({
|
||||
projectId: project_id,
|
||||
model: VisitModel,
|
||||
from, to, slice, timeOffset, domain
|
||||
from, to, slice, timeOffset, domain,
|
||||
debug: true
|
||||
});
|
||||
return timelineData;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user