Weekly horoscope: its own page, a Monday e-mail, and one page for every e-mail setting
CI / test (push) Successful in 3m17s
CI / build (push) Skipped
CI / deploy (push) Skipped

- The week's sky on the member's own chart (horoscope-api POST /v1/week,
  astro_engine::week): the planets' aspects to the natal points with the day
  each is exact, positions, the Moon's signs, lunar phases, stations and sign
  changes; stored once per chart and week (weekly_skies, migration 0047).
- Its text is a 'weekly' analysis written by the summary's (cheap) model when
  the member opens /heti-horoszkop: one month per page, the newest week
  first, the waiting animation while it is written. In the menu, and linked
  from the chart page.
- Monday 7:00 e-mail (worker task 'weekly'): only that it is there; on by
  default for everyone with a chart, members of today too. Its footer opens
  /ertesitesek?token=…, where the weekly e-mail and every forum e-mail can
  be set without logging in; the mail client's one-click unsubscribe turns
  off the weekly one. Also a switch on the page and on the Profile page.
- Privacy notice (HU/EN) describes it; ratings, admin labels and the model
  page know the new kind.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
feco
2026-11-27 09:40:09 +00:00
co-authored by Claude Opus 5.5
parent 50c29e4595
commit 0358e137f1
46 changed files with 2368 additions and 70 deletions
@@ -0,0 +1,37 @@
-- The free weekly horoscope: the week's sky on a member's own chart (from
-- the horoscope service), its text (an analysis of kind 'weekly', written by
-- the summary's model), and the Monday e-mail that says it is there (on for
-- everyone, the members of today too; it can be turned off).
CREATE TABLE weekly_skies (
chart_id uuid NOT NULL REFERENCES charts (id) ON DELETE CASCADE,
-- The chart's data when it was calculated: new birth data, new week sky.
chart_hash text NOT NULL,
-- The Monday the week starts on (Hungarian time).
week_start date NOT NULL,
result jsonb NOT NULL,
created_at timestamptz NOT NULL DEFAULT now(),
PRIMARY KEY (chart_id, chart_hash, week_start)
);
ALTER TABLE analyses ADD COLUMN week_start date;
ALTER TABLE analyses DROP CONSTRAINT analyses_kind_check;
ALTER TABLE analyses ADD CONSTRAINT analyses_kind_check
CHECK (kind IN ('natal', 'synastry', 'summary', 'forecast', 'tarot', 'celebrity', 'weekly'));
ALTER TABLE analyses DROP CONSTRAINT analyses_target;
ALTER TABLE analyses ADD CONSTRAINT analyses_target CHECK (
(kind IN ('natal', 'summary', 'celebrity') AND chart_id IS NOT NULL AND synastry_id IS NULL AND forecast_id IS NULL)
OR (kind = 'synastry' AND synastry_id IS NOT NULL AND chart_id IS NULL AND forecast_id IS NULL)
OR (kind = 'forecast' AND forecast_id IS NOT NULL AND chart_id IS NULL AND synastry_id IS NULL)
OR (kind = 'tarot' AND tarot IS NOT NULL AND chart_id IS NULL AND synastry_id IS NULL AND forecast_id IS NULL)
OR (kind = 'weekly' AND chart_id IS NOT NULL AND week_start IS NOT NULL AND synastry_id IS NULL AND forecast_id IS NULL)
);
-- The Monday e-mail: on unless the member turns it off. The token opens the
-- page of every e-mail setting from an e-mail's footer (no login needed).
ALTER TABLE users ADD COLUMN weekly_email boolean NOT NULL DEFAULT true;
ALTER TABLE users ADD COLUMN weekly_email_sent_on date;
ALTER TABLE users ADD COLUMN email_token uuid NOT NULL DEFAULT gen_random_uuid();
CREATE UNIQUE INDEX users_email_token ON users (email_token);