Initial Entry logic

This commit is contained in:
Alexandru Eduard Farcas
2025-05-05 11:12:09 +03:00
parent 945758e879
commit 965af919e7
3 changed files with 74 additions and 21 deletions
+22
View File
@@ -0,0 +1,22 @@
"use server"
import { db } from "@/lib/db";
async function handleEnterGiveawayClick(giveawayId: string, entryValue: number, userId: string) {
await db.entry.create({
data: {
userId: userId,
giveawayId: giveawayId,
weight: 1,
},
});
await db.user.update({
where: { id: userId },
data: {
coins: { decrement: entryValue },
},
});
}
export default handleEnterGiveawayClick;