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,22 @@
import { endOfDay, startOfDay } from "date-fns";
import { Types } from "mongoose";
import { VisitModel } from "~/shared/schema/metrics/VisitSchema";
type DomainsListOptions = {
project_id: string,
date: Date
}
export async function getAllDomains(options: DomainsListOptions) {
const domains = await VisitModel.aggregate([
{
$match: {
project_id: new Types.ObjectId(options.project_id),
created_at: { $gte: startOfDay(options.date), $lte: endOfDay(options.date) }
},
},
{ $group: { _id: "$website" } }
]);
return domains.map(e => e._id) as string[];
}