Files
var-monorepo/apps/hub/helper/events.ts

20 lines
745 B
TypeScript

import { Event, Participant } from "@repo/db";
import axios from "axios";
export const eventCompleted = (event: Event, participant?: Participant) => {
if (!participant) return false;
if (event.finisherMoodleCourseId && !participant.finisherMoodleCurseCompleted) return false;
if (event.hasPresenceEvents && !participant.attended) return false;
return true;
};
export const handleParticipantFinished = async (participantId: string) =>
axios.post(`${process.env.NEXT_PUBLIC_HUB_SERVER_URL}/event/handle-participant-finished`, {
participantId,
});
export const handleParticipantEnrolled = async (participantId: string) =>
axios.post(`${process.env.NEXT_PUBLIC_HUB_SERVER_URL}/event/handle-participant-enrolled`, {
participantId,
});