mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-10 07:48:37 +01:00
add dashboard
This commit is contained in:
14
dashboard/server/api/ai/functions/AI_Visits.ts
Normal file
14
dashboard/server/api/ai/functions/AI_Visits.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { VisitModel } from "@schema/metrics/VisitSchema";
|
||||
|
||||
|
||||
|
||||
export async function getVisitsCountFromDateRange(project_id: string, from?: string, to?: string) {
|
||||
const result = await VisitModel.countDocuments({
|
||||
project_id,
|
||||
created_at: {
|
||||
$gt: from ? new Date(from).getTime() : new Date(2023).getTime(),
|
||||
$lt: to ? new Date(to).getTime() : new Date().getTime(),
|
||||
}
|
||||
});
|
||||
return { count: result };
|
||||
}
|
||||
Reference in New Issue
Block a user