Dnevni recept: tabela daily_recipes, API /api/recipes, prikaz na /rezepte

This commit is contained in:
sebastjan
2026-08-15 17:06:09 +02:00
parent 001a05fe16
commit b92c39d9f0
4 changed files with 118 additions and 0 deletions
+21
View File
@@ -4,6 +4,7 @@ import { storage } from "./storage";
import { insertArticleSchema } from "@shared/schema";
import { seedDatabase } from "./seed";
import { generateDailyHoroscopes, getHoroscopesForToday, getOrGenerateHoroscope, setHoroscopeImages } from "./horoscope-generator";
import { getRecipeForToday, upsertRecipe } from "./daily-recipe";
import { startDailyScheduler } from "./scheduler";
import { analyzeAllArticleImages, getCachedFocalPoints } from "./focal-point";
import { optimizeImage } from "./image-optimizer";
@@ -754,6 +755,26 @@ export async function registerRoutes(
}
});
app.get("/api/recipes/today", async (_req, res) => {
try {
const recipe = await getRecipeForToday();
res.json(recipe);
} catch (err: any) {
res.status(500).json({ message: err.message });
}
});
app.post("/api/recipes", requireApiKey, async (req, res) => {
try {
const { name } = req.body || {};
if (!name) return res.status(400).json({ message: "name ist erforderlich" });
const row = await upsertRecipe(req.body);
res.json(row);
} catch (err: any) {
res.status(500).json({ message: err.message });
}
});
app.get("/api/horoscopes/today", async (_req, res) => {
try {
const horoscopes = await getHoroscopesForToday();