"use server" import prisma from "@/lib/prisma" import { revalidatePath } from "next/cache" import { sendNotification } from "@/lib/notifications" export async function updatePlan(planId: string, data: { instructions?: string; webhookUrl?: string; notifyAll?: boolean }) { const plan = await prisma.plan.update({ where: { id: planId }, data: { instructions: data.instructions, webhookUrl: data.webhookUrl, notifyAll: data.notifyAll, } }) if (data.instructions && plan.webhookUrl && plan.notifyAll) { await sendNotification(plan.webhookUrl, `📝 UPDATED: Cat instructions have been modified.`) } revalidatePath(`/dashboard/${planId}`) }