Detailed analysis button, loading wheel, birth data change limits
CI / test (push) Successful in 41s
CI / build (push) Successful in 4m11s
CI / deploy (push) Skipped

Backend:
- own birth data: three corrections within an hour of the first save,
  then one change per 24 hours (birth_data_changes); 429
  birth_data_change_limit with the user-facing message; /v1/me
  birth_change shows the notice; admins are not limited
- admins get detailed analyses free (no unit spent)
- POST /v1/payments/mock (MOCK_PAYMENTS): stand-in payment that adds a
  unit, until Stripe is connected; on in the compose files for now

Frontend:
- detailed analysis offer: admin starts it free, users with units
  confirm, others go through the (stand-in) payment step
- turning wheel with elapsed time while the summary or the analysis is
  being written
- no "adatok javítása" on the chart page (only in the profile), limit
  notice there; wheel hover highlighting 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-17 06:45:33 +00:00
co-authored by Claude Opus 5.5
parent 85337f2c79
commit e5cfbd6cdd
23 changed files with 544 additions and 110 deletions
+7 -4
View File
@@ -1,7 +1,7 @@
//! Text analyses (LLM) of charts and synastries.
//!
//! A request creates a `pending` analysis and spends one unit of its kind
//! (`natal` or `synastry`, see [`credits`]); the worker
//! (`natal` or `synastry`, see [`credits`]; admins pay nothing); the worker
//! writes the text later. A finished analysis with the same cache key (same
//! chart or synastry hash, prompt version, model and language) is copied
//! instead, free of charge, so the same chart is never paid for twice.
@@ -29,6 +29,7 @@ use crate::auth::AuthUser;
use crate::credits::{self, Unit};
use crate::error::{ApiError, ApiResult};
use crate::views::{rfc3339, rfc3339_opt, sha256_hex};
use db::Role;
#[derive(Debug, Clone, sqlx::FromRow)]
pub struct AnalysisRow {
@@ -117,12 +118,14 @@ async fn request(
req: AnalysisRequest,
) -> ApiResult<(StatusCode, Json<Value>)> {
let language = validate_locale(state, Some(req.language.as_deref().unwrap_or(&auth.user.locale)))?;
// Admins get detailed analyses free of charge.
let unit = match target {
Target::Synastry { .. } => Unit::Synastry,
_ => Unit::Natal,
_ if auth.user.has_role(Role::Admin) => None,
Target::Synastry { .. } => Some(Unit::Synastry),
_ => Some(Unit::Natal),
};
let model = state.config.analysis_model.clone();
let (status, row) = queue(state, auth.id(), &target, &language, &model, Some(unit)).await?;
let (status, row) = queue(state, auth.id(), &target, &language, &model, unit).await?;
Ok((status, Json(row.view())))
}