"use server"; import { revalidatePath } from "next/cache"; import { prisma } from "@/lib/db"; import { requireUserId } from "@/lib/auth-helpers"; import { GroupNoteContentSchema } from "@/lib/validation/group"; export async function updateGroupNote(groupId: string, noteContent: string): Promise { const userId = await requireUserId(); const parsed = GroupNoteContentSchema.parse(noteContent); const { count } = await prisma.group.updateMany({ where: { id: groupId, category: { userId } }, data: { noteContent: parsed }, }); if (count === 0) throw new Error("Group not found"); revalidatePath("/"); }