Add horoscope-api, synastry, and backend services

- horoscope-api: Swiss Ephemeris natal charts, timezone/place resolution,
  POST /v1/natal and POST /v1/synastry
- backend: users with roles, email/password and Google login, saved charts,
  synastries and invites, analyses with credit ledger, public shares, admin
- shared crates: astro-engine, db (migrations), horoscope-client, service-kit
- docker-compose with postgres, legacy Java project for reference

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-15 10:25:35 +00:00
co-authored by Claude Opus 5.5
parent 0b5416df45
commit 3a84110565
148 changed files with 95803 additions and 0 deletions
+105
View File
@@ -0,0 +1,105 @@
//! Raw FFI bindings to the subset of the Swiss Ephemeris API used by the
//! services. The library keeps global state (ephemeris path, sidereal mode,
//! open file handles) and is compiled with `TLSOFF`, so every call must be
//! serialized by the caller.
#![allow(non_upper_case_globals)]
use std::os::raw::{c_char, c_double, c_int};
pub const OK: i32 = 0;
pub const ERR: i32 = -1;
/// Size of the error string buffers (`AS_MAXCH`).
pub const AS_MAXCH: usize = 256;
pub const SE_JUL_CAL: c_int = 0;
pub const SE_GREG_CAL: c_int = 1;
pub const SE_ECL_NUT: i32 = -1;
pub const SE_SUN: i32 = 0;
pub const SE_MOON: i32 = 1;
pub const SE_MERCURY: i32 = 2;
pub const SE_VENUS: i32 = 3;
pub const SE_MARS: i32 = 4;
pub const SE_JUPITER: i32 = 5;
pub const SE_SATURN: i32 = 6;
pub const SE_URANUS: i32 = 7;
pub const SE_NEPTUNE: i32 = 8;
pub const SE_PLUTO: i32 = 9;
pub const SE_MEAN_NODE: i32 = 10;
pub const SE_TRUE_NODE: i32 = 11;
pub const SE_MEAN_APOG: i32 = 12;
pub const SE_OSCU_APOG: i32 = 13;
pub const SE_CHIRON: i32 = 15;
pub const SE_PHOLUS: i32 = 16;
pub const SE_CERES: i32 = 17;
pub const SE_PALLAS: i32 = 18;
pub const SE_JUNO: i32 = 19;
pub const SE_VESTA: i32 = 20;
pub const SEFLG_JPLEPH: i32 = 1;
pub const SEFLG_SWIEPH: i32 = 2;
pub const SEFLG_MOSEPH: i32 = 4;
pub const SEFLG_TRUEPOS: i32 = 16;
pub const SEFLG_NONUT: i32 = 64;
pub const SEFLG_SPEED: i32 = 256;
pub const SEFLG_EQUATORIAL: i32 = 2 * 1024;
pub const SEFLG_TOPOCTR: i32 = 32 * 1024;
pub const SEFLG_SIDEREAL: i32 = 64 * 1024;
pub const SE_SIDM_FAGAN_BRADLEY: i32 = 0;
pub const SE_SIDM_LAHIRI: i32 = 1;
pub const SE_SIDM_DELUCE: i32 = 2;
pub const SE_SIDM_RAMAN: i32 = 3;
pub const SE_SIDM_KRISHNAMURTI: i32 = 5;
pub const SE_SIDM_YUKTESHWAR: i32 = 7;
pub const SE_SIDM_GALCENT_0SAG: i32 = 17;
pub const SE_SIDM_TRUE_CITRA: i32 = 27;
unsafe extern "C" {
pub fn swe_version(s: *mut c_char) -> *mut c_char;
pub fn swe_set_ephe_path(path: *const c_char);
pub fn swe_close();
pub fn swe_set_sid_mode(sid_mode: i32, t0: c_double, ayan_t0: c_double);
pub fn swe_get_ayanamsa_ex_ut(tjd_ut: c_double, iflag: i32, daya: *mut c_double, serr: *mut c_char) -> i32;
pub fn swe_set_topo(geolon: c_double, geolat: c_double, geoalt: c_double);
pub fn swe_calc_ut(tjd_ut: c_double, ipl: i32, iflag: i32, xx: *mut c_double, serr: *mut c_char) -> i32;
pub fn swe_pheno_ut(tjd_ut: c_double, ipl: i32, iflag: i32, attr: *mut c_double, serr: *mut c_char) -> i32;
pub fn swe_houses_ex2(
tjd_ut: c_double,
iflag: i32,
geolat: c_double,
geolon: c_double,
hsys: c_int,
cusps: *mut c_double,
ascmc: *mut c_double,
cusp_speed: *mut c_double,
ascmc_speed: *mut c_double,
serr: *mut c_char,
) -> c_int;
pub fn swe_house_name(hsys: c_int) -> *const c_char;
pub fn swe_julday(year: c_int, month: c_int, day: c_int, hour: c_double, gregflag: c_int) -> c_double;
pub fn swe_revjul(
jd: c_double,
gregflag: c_int,
jyear: *mut c_int,
jmon: *mut c_int,
jday: *mut c_int,
jut: *mut c_double,
);
pub fn swe_utc_to_jd(
iyear: i32,
imonth: i32,
iday: i32,
ihour: i32,
imin: i32,
dsec: c_double,
gregflag: i32,
dret: *mut c_double,
serr: *mut c_char,
) -> i32;
pub fn swe_deltat_ex(tjd: c_double, iflag: i32, serr: *mut c_char) -> c_double;
pub fn swe_sidtime(tjd_ut: c_double) -> c_double;
}