feat: add batch-cooking sessions (single "mega recipe" with dish sections)
New AI-generated batch-cooking flow: pick N dinners/lunches + servings, get one unified recipe covering a full prep session — merged shopping list, steps tagged per-dish (a step can advance several dishes at once, e.g. a shared oven bake), and per-dish storage (fridge/freezer) + exact day-of reheat/finishing instructions. Schema: recipes.isBatchCook, recipeSteps.appliesTo (dish names), new recipeBatchDishes table. Batch recipes are excluded from the normal /recipes list and live under their own /batch-cooking section. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
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 (
|
||||
<BatchCookingPageContent
|
||||
sessions={sessions.map((r) => ({
|
||||
id: r.id,
|
||||
title: r.title,
|
||||
description: r.description,
|
||||
baseServings: r.baseServings,
|
||||
createdAt: r.createdAt.toISOString(),
|
||||
dishCount: r.batchDishes.length,
|
||||
}))}
|
||||
/>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user