import type { Metadata } from "next"; import { headers } from "next/headers"; import { auth } from "@/lib/auth/server"; import { db, recipes, eq, and, desc } from "@epicure/db"; import { BatchCookingPageContent } from "@/components/recipe/batch-cooking-page-content"; export const metadata: Metadata = {}; export default async function BatchCookingPage() { const session = await auth.api.getSession({ headers: await headers() }); if (!session) return null; const sessions = await db.query.recipes.findMany({ where: and(eq(recipes.authorId, session.user.id), eq(recipes.isBatchCook, true)), orderBy: desc(recipes.createdAt), with: { batchDishes: true }, }); return ( ({ id: r.id, title: r.title, description: r.description, baseServings: r.baseServings, createdAt: r.createdAt.toISOString(), dishCount: r.batchDishes.length, }))} /> ); }