"use server"; import prisma from "@/lib/db"; import type { PaymentType } from "@/lib/types"; import { revalidatePath } from "next/cache"; export async function createPayment(data: PaymentType) { console.log("hi", data); const payment = await prisma.payment.create({ data: { amount: data.amount, numberOfMonths: data.numberOfMonths, paid: data.paid, userId: data.userId, devices: { connect: data.deviceIds.map((id) => { return { id, }; }), }, }, }); revalidatePath("/devices"); return payment; }