mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-10 15:58:38 +01:00
14 lines
451 B
TypeScript
14 lines
451 B
TypeScript
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 };
|
|
} |