Yearly forecast: solar return, transits, progressions, profection, eclipses
CI / test (push) Successful in 56s
CI / build (push) Successful in 4m41s
CI / deploy (push) Skipped

- astro-engine: forecast module (solar return moment, slow-planet transits
  with exact dates and periods, natal house ingresses, secondary
  progressions, annual profection, eclipses via Swiss Ephemeris)
- horoscope-api: POST /v1/forecast, solar return chart cast for the place
  of the birthday
- backend: forecasts table, /v1/charts/{id}/forecasts, /v1/forecasts/{id}
  and its analyses using a new 'forecast' unit; current year of life open,
  the next one 30 days before the birthday
- packages: Páros and Család include forecasts (6 000 / 11 000 Ft),
  +1 éves előrejelzés add-on 2 500 Ft; Egy elemzés unchanged
- worker and prompt: forecast kind with five sections and forecast rules
  (trends, no event predictions); no birth data, place or exact age sent
- frontend: /kepletek/{id}/elorejelzes with the solar return wheel, the
  keys of the year, a monthly timeline, transit list and detailed forecast
- data export: forecasts added, model name removed

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-18 08:19:13 +00:00
co-authored by Claude Opus 5.5
parent 829c33e52f
commit f1bd34c394
42 changed files with 4764 additions and 85 deletions
+12 -5
View File
@@ -1,6 +1,7 @@
//! Analysis units: a detailed natal analysis uses one `natal` unit, a
//! synastry analysis one `synastry` unit. Units come from purchases or an
//! admin; a failed analysis gives its unit back (the worker does that).
//! synastry analysis one `synastry` unit, a yearly forecast one `forecast`
//! unit. Units come from purchases or an admin; a failed analysis gives its
//! unit back (the worker does that).
use serde::{Deserialize, Serialize};
use serde_json::{Value, json};
@@ -14,6 +15,8 @@ use crate::error::ApiError;
pub enum Unit {
Natal,
Synastry,
/// A yearly forecast (see `routes::forecasts`).
Forecast,
/// A slot for adding a person (see [`crate::persons`]).
Person,
}
@@ -23,6 +26,7 @@ impl Unit {
match self {
Unit::Natal => "natal",
Unit::Synastry => "synastry",
Unit::Forecast => "forecast",
Unit::Person => "person",
}
}
@@ -33,6 +37,7 @@ impl Unit {
pub struct Balance {
pub natal: i64,
pub synastry: i64,
pub forecast: i64,
/// Bought person slots (not the slots left; see [`crate::persons::slots`]).
pub person: i64,
}
@@ -42,26 +47,28 @@ impl Balance {
match unit {
Unit::Natal => self.natal,
Unit::Synastry => self.synastry,
Unit::Forecast => self.forecast,
Unit::Person => self.person,
}
}
pub fn view(self) -> Value {
json!({ "natal": self.natal, "synastry": self.synastry })
json!({ "natal": self.natal, "synastry": self.synastry, "forecast": self.forecast })
}
}
pub async fn balance(conn: &mut PgConnection, user_id: Uuid) -> Result<Balance, ApiError> {
let (natal, synastry, person): (i64, i64, i64) = sqlx::query_as(
let (natal, synastry, forecast, person): (i64, i64, i64, i64) = sqlx::query_as(
"SELECT COALESCE(SUM(delta) FILTER (WHERE unit = 'natal'), 0)::bigint, \
COALESCE(SUM(delta) FILTER (WHERE unit = 'synastry'), 0)::bigint, \
COALESCE(SUM(delta) FILTER (WHERE unit = 'forecast'), 0)::bigint, \
COALESCE(SUM(delta) FILTER (WHERE unit = 'person' AND reason <> 'person'), 0)::bigint \
FROM credit_ledger WHERE user_id = $1",
)
.bind(user_id)
.fetch_one(conn)
.await?;
Ok(Balance { natal, synastry, person })
Ok(Balance { natal, synastry, forecast, person })
}
/// Spends one unit inside the caller's transaction. The user row is locked