mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-10 15:58:38 +01:00
17 lines
514 B
TypeScript
17 lines
514 B
TypeScript
import { EventModel } from "~/shared/schema/metrics/EventSchema";
|
|
import { VisitModel } from "~/shared/schema/metrics/VisitSchema";
|
|
|
|
export default defineEventHandler(async event => {
|
|
|
|
const ctx = await getRequestContext(event, 'pid', 'permission:webAnalytics');
|
|
|
|
const { project_id } = ctx;
|
|
|
|
const hasEvents = await EventModel.exists({ project_id });
|
|
if (hasEvents) return true;
|
|
const hasVisits = await VisitModel.exists({ project_id });
|
|
if (hasVisits) return true;
|
|
|
|
return false;
|
|
|
|
}); |