fix prisma import

This commit is contained in:
2025-02-21 16:13:13 +08:00
parent bb5ca3a0ea
commit d68a39066a
35 changed files with 66 additions and 64 deletions

View File

@@ -5,28 +5,37 @@ import { MODEL_EVENT_PESERTA } from "../../_lib/interface";
import { revalidatePath } from "next/cache";
export async function Event_funJoinEvent(data: MODEL_EVENT_PESERTA) {
const res = await prisma.event_Peserta.create({
data: {
eventId: data.eventId,
userId: data.userId,
},
try {
console.log("Data >", data)
const res = await prisma.event_Peserta.create({
data: {
eventId: data.eventId,
userId: data.userId,
},
select: {
Event: {
select: {
id: true,
title: true,
authorId: true,
select: {
Event: {
select: {
id: true,
title: true,
authorId: true,
},
},
},
},
});
});
if (!res) return { status: 400, message: "Gagal Join" };
revalidatePath("/dev/event/detail/main");
return {
data: res,
status: 200,
message: "Berhasil Join",
};
if (!res) return { status: 400, message: "Gagal Join" };
revalidatePath("/dev/event/detail/main");
return {
data: res,
status: 200,
message: "Berhasil Join",
};
} catch (error) {
return {
status: 500,
message: "Error Join",
error: (error as Error).message,
};
}
}