added chron to hub server, removed starterEvent
This commit is contained in:
26
apps/hub/app/(app)/events/actions.ts
Normal file
26
apps/hub/app/(app)/events/actions.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
"use server";
|
||||
import { enrollUserInCourse } from "../../../helper/moodle";
|
||||
import { prisma } from "@repo/db";
|
||||
|
||||
export const inscribeToMoodleCourse = async (
|
||||
moodleCourseId: string | number,
|
||||
userMoodleId: string | number,
|
||||
) => {
|
||||
await enrollUserInCourse(moodleCourseId, userMoodleId);
|
||||
};
|
||||
|
||||
export const addParticipant = async (eventId: number, userId: string) => {
|
||||
const participant = await prisma.participant.findFirst({
|
||||
where: {
|
||||
userId: userId,
|
||||
},
|
||||
});
|
||||
if (!participant) {
|
||||
await prisma.participant.create({
|
||||
data: {
|
||||
userId: userId,
|
||||
eventId,
|
||||
},
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user