new selfhosted version

This commit is contained in:
antonio
2025-11-28 14:11:51 +01:00
parent afda29997d
commit 951860f67e
1046 changed files with 72586 additions and 574750 deletions

View File

@@ -0,0 +1,37 @@
import { VisitModel } from "~/shared/schema/metrics/VisitSchema";
import { executeAdvancedTimelineAggregation } from "../services/TimelineService";
import { Types } from "mongoose";
import { StandardController, TimelineOptions } from "./UtilsController";
class SessionController extends StandardController {
constructor() { super('session', e => e.count); }
async getTimeline(options: TimelineOptions): Promise<any[]> {
const { project_id, from, to, slice, domain } = options;
const timelineData = await executeAdvancedTimelineAggregation({
projectId: new Types.ObjectId(project_id),
model: VisitModel,
from, to, slice, domain,
allowDisk: true,
customIdGroup: { session: '$session' },
customQueries: [
{
index: 2,
query: {
$group: { _id: { date: '$_id.date' }, count: { $sum: 1 } }
}
}
],
forced: options.ignoreSliceSize,
});
return timelineData;
}
}
export const sessionController = new SessionController();