feat(recipe-generation): STEG 2 RUNDA 2 prep
- Food-safety prompt + lint: doneness krävs, gyllenbrun räcker inte - DensityGPerMl för ginger, örter, mushroom, salsa, corn, olives, peas - RUNDA_2_TARGETS fokuserade på gap-celler (paprika, blandfärs, räkor, torsk, svarta bönor) - Export-verified script + scale-smoke-test - Temp-skript borttagna; inga nycklar kvar i kod
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import { createDatabase, closeDatabase } from "@app/database";
|
||||
import * as fs from "node:fs/promises";
|
||||
import * as path from "node:path";
|
||||
|
||||
async function main() {
|
||||
const dbUrl = process.env.DATABASE_URL;
|
||||
if (!dbUrl) throw new Error("DATABASE_URL saknas");
|
||||
const { db } = createDatabase(dbUrl);
|
||||
|
||||
const recipes = await db.query.recipes.findMany({
|
||||
where: (t, { eq }) => eq(t.verificationStatus, "verified"),
|
||||
});
|
||||
|
||||
const enriched = [];
|
||||
for (const r of recipes) {
|
||||
const ingredients = await db.query.recipeIngredients.findMany({
|
||||
where: (t, { eq }) => eq(t.recipeId, r.id),
|
||||
});
|
||||
const steps = await db.query.recipeSteps.findMany({
|
||||
where: (t, { eq }) => eq(t.recipeId, r.id),
|
||||
});
|
||||
enriched.push({ ...r, ingredients, steps });
|
||||
}
|
||||
|
||||
const publicDir = "/mnt/c/Users/Public";
|
||||
const outPath = path.join(publicDir, "cibello-verified-119-result.json");
|
||||
await fs.writeFile(outPath, JSON.stringify({
|
||||
exportedAt: new Date().toISOString(),
|
||||
count: enriched.length,
|
||||
recipes: enriched,
|
||||
}, null, 2), "utf-8");
|
||||
|
||||
console.error(`[export-verified] Exported ${recipes.length} verified recipes to ${outPath}`);
|
||||
await closeDatabase();
|
||||
}
|
||||
|
||||
main().catch((err) => { console.error(err); process.exit(1); });
|
||||
Reference in New Issue
Block a user