Detailed analysis button, loading wheel, birth data change limits
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:
@@ -14,6 +14,7 @@ use uuid::Uuid;
|
||||
use super::{Body, IdPath, St};
|
||||
use crate::AppState;
|
||||
use crate::auth::AuthUser;
|
||||
use crate::birth_changes;
|
||||
use crate::error::{ApiError, ApiResult};
|
||||
use crate::views::{chart_hash, chart_highlights, rfc3339};
|
||||
|
||||
@@ -130,7 +131,8 @@ fn clean_birth(birth: Value) -> Result<Value, ApiError> {
|
||||
|
||||
/// Saves a new chart. If the user already has a chart with exactly the same
|
||||
/// birth data, that one is returned (and made primary if asked) instead of
|
||||
/// calculating it again.
|
||||
/// calculating it again. Replacing the user's own chart counts against the
|
||||
/// birth data change limit ([`birth_changes`]).
|
||||
pub async fn create(
|
||||
State(state): St,
|
||||
auth: AuthUser,
|
||||
@@ -157,6 +159,7 @@ pub async fn create(
|
||||
.bind(chart.id)
|
||||
.fetch_one(&mut *tx)
|
||||
.await?;
|
||||
birth_changes::record(&mut tx, &auth, row.id).await?;
|
||||
tx.commit().await?;
|
||||
queue_summary(&state, &auth, &row).await;
|
||||
return Ok((StatusCode::OK, Json(row.owner_view())));
|
||||
@@ -194,6 +197,9 @@ pub async fn create(
|
||||
.bind(hash)
|
||||
.fetch_one(&mut *tx)
|
||||
.await?;
|
||||
if req.is_primary {
|
||||
birth_changes::record(&mut tx, &auth, row.id).await?;
|
||||
}
|
||||
tx.commit().await?;
|
||||
queue_summary(&state, &auth, &row).await;
|
||||
Ok((StatusCode::CREATED, Json(row.owner_view())))
|
||||
@@ -243,6 +249,9 @@ pub async fn update(
|
||||
.bind(id)
|
||||
.fetch_one(&mut *tx)
|
||||
.await?;
|
||||
if is_primary && !chart.is_primary {
|
||||
birth_changes::record(&mut tx, &auth, id).await?;
|
||||
}
|
||||
tx.commit().await?;
|
||||
Ok(Json(row.owner_view()))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user