Horoskopska stran: slike znamenj (image_url + /api/horoscopes/images)
This commit is contained in:
+14
-1
@@ -3,7 +3,7 @@ import { createServer, type Server } from "http";
|
||||
import { storage } from "./storage";
|
||||
import { insertArticleSchema } from "@shared/schema";
|
||||
import { seedDatabase } from "./seed";
|
||||
import { generateDailyHoroscopes, getHoroscopesForToday, getOrGenerateHoroscope, getCosmicEventsForToday, generateCosmicEvents } from "./horoscope-generator";
|
||||
import { generateDailyHoroscopes, getHoroscopesForToday, getOrGenerateHoroscope, getCosmicEventsForToday, generateCosmicEvents, setHoroscopeImages } from "./horoscope-generator";
|
||||
import { startDailyScheduler } from "./scheduler";
|
||||
import { analyzeAllArticleImages, getCachedFocalPoints } from "./focal-point";
|
||||
import { optimizeImage } from "./image-optimizer";
|
||||
@@ -741,6 +741,19 @@ export async function registerRoutes(
|
||||
});
|
||||
|
||||
// Horoscope API
|
||||
app.post("/api/horoscopes/images", requireApiKey, async (req, res) => {
|
||||
try {
|
||||
const { dateStr, images } = req.body || {};
|
||||
if (!dateStr || typeof images !== "object" || images === null) {
|
||||
return res.status(400).json({ message: "dateStr und images sind erforderlich" });
|
||||
}
|
||||
const updated = await setHoroscopeImages(dateStr, images);
|
||||
res.json({ updated });
|
||||
} catch (err: any) {
|
||||
res.status(500).json({ message: err.message });
|
||||
}
|
||||
});
|
||||
|
||||
app.get("/api/horoscopes/today", async (_req, res) => {
|
||||
try {
|
||||
const horoscopes = await getHoroscopesForToday();
|
||||
|
||||
Reference in New Issue
Block a user