mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-11 16:28:37 +01:00
new selfhosted version
This commit is contained in:
23
dashboard/server/controllers/VisitController.ts
Normal file
23
dashboard/server/controllers/VisitController.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { VisitModel } from "~/shared/schema/metrics/VisitSchema";
|
||||
import { executeAdvancedTimelineAggregation } from "../services/TimelineService";
|
||||
import { Types } from "mongoose";
|
||||
import { StandardController, TimelineOptions } from "./UtilsController";
|
||||
|
||||
|
||||
class VisitController extends StandardController {
|
||||
constructor() { super('visit', 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,
|
||||
forced: options.ignoreSliceSize
|
||||
});
|
||||
return timelineData;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export const visitController = new VisitController();
|
||||
Reference in New Issue
Block a user