Horoskop in kozmicni dogodki: dnevno AI generiranje + scheduler

- Nov dnevni scheduler (server/scheduler.ts): vsak dan ob zagonu in vsakih 6h
  preveri/generira horoskope in kozmicne dogodke (prej samo enkrat ob zagonu)
- Kozmicni dogodki so zdaj AI-generirani in dnevni (nova tabela cosmic_events
  + /api/cosmic-events), namesto hardcoded fiksnih datumov iz feb/mar 2026
- Naslovni horoskop widget bere pravi AI horoskop za danes (prej staticni tekst)
- Frontend: staleTime 30min + refetchOnWindowFocus za dnevno osvezevanje
This commit is contained in:
Folx Ops
2026-06-07 15:05:20 +00:00
parent 6c34d44cea
commit 365da96f5b
6 changed files with 204 additions and 8 deletions
+21 -1
View File
@@ -77,7 +77,25 @@ function getEventColor(type: string) {
}
}
interface CosmicEvent {
title: string;
description: string;
dateRange: string;
icon: string;
type: string;
affectedSigns: string[];
}
function AstroEventsSection() {
const { data: apiEvents = [] } = useQuery<CosmicEvent[]>({
queryKey: ["/api/cosmic-events"],
staleTime: 1000 * 60 * 30,
refetchOnWindowFocus: true,
});
// Use live AI-generated events when available, otherwise fall back to static list.
const events = apiEvents.length > 0 ? apiEvents : ASTRO_EVENTS;
return (
<section className="mb-10" data-testid="section-astro-events">
<h2 className="text-lg font-bold text-foreground flex items-center gap-2 mb-4">
@@ -85,7 +103,7 @@ function AstroEventsSection() {
Aktuelle kosmische Ereignisse
</h2>
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4">
{ASTRO_EVENTS.map((event, i) => {
{events.map((event, i) => {
const ec = getEventColor(event.type);
return (
<div
@@ -378,6 +396,8 @@ export default function HoroscopePage() {
const { data: aiHoroscopes = [], isLoading: aiLoading } = useQuery<AIHoroscope[]>({
queryKey: ["/api/horoscopes/today"],
staleTime: 1000 * 60 * 30,
refetchOnWindowFocus: true,
});
useEffect(() => {