mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-10 15:58:38 +01:00
Rewrite endpoints + bar cards
This commit is contained in:
21
dashboard/server/api/project/first_interaction.ts
Normal file
21
dashboard/server/api/project/first_interaction.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { EventModel } from "@schema/metrics/EventSchema";
|
||||
import { VisitModel } from "@schema/metrics/VisitSchema";
|
||||
|
||||
export default defineEventHandler(async event => {
|
||||
|
||||
const data = await getRequestData(event, {
|
||||
requireSchema: false,
|
||||
allowLitlyx: false,
|
||||
requireSlice: false
|
||||
});
|
||||
if (!data) return;
|
||||
|
||||
const { project_id } = data;
|
||||
const hasEvent = await EventModel.exists({ project_id });
|
||||
if (hasEvent) return true;
|
||||
const hasVisit = await VisitModel.exists({ project_id });
|
||||
if (hasVisit) return true;
|
||||
|
||||
return false;
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user