"use server"; import { prisma } from "@streamclipper/db"; import { revalidatePath } from "next/cache"; export async function addChannel(formData: FormData) { const name = String(formData.get("name") ?? "").trim(); const youtubeHandle = String(formData.get("youtubeHandle") ?? "").trim(); const channelId = String(formData.get("channelId") ?? "").trim(); if (!name || !youtubeHandle || !channelId) { throw new Error("Kanal adı, handle ve channel_id alanları zorunlu."); } await prisma.channel.create({ data: { name, youtubeHandle, channelId, isActive: true }, }); revalidatePath("/"); }