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
+15
View File
@@ -50,6 +50,21 @@ export const dailyHoroscopes = pgTable("daily_horoscopes", {
export type DailyHoroscope = typeof dailyHoroscopes.$inferSelect;
export const cosmicEvents = pgTable("cosmic_events", {
id: serial("id").primaryKey(),
dateStr: varchar("date_str", { length: 10 }).notNull(),
position: integer("position").notNull(),
title: varchar("title", { length: 120 }).notNull(),
description: text("description").notNull(),
dateRange: varchar("date_range", { length: 120 }).notNull(),
icon: varchar("icon", { length: 20 }).notNull(),
type: varchar("type", { length: 20 }).notNull(),
affectedSigns: text("affected_signs").notNull(),
createdAt: timestamp("created_at").notNull().defaultNow(),
});
export type CosmicEvent = typeof cosmicEvents.$inferSelect;
export const users = pgTable("users", {
id: varchar("id").primaryKey().default(sql`gen_random_uuid()`),
username: text("username").notNull().unique(),