Drop the unlimited package, new prices, AI quality note
- The unlimited package is gone (easy to resell, e.g. by an astrologer): catalog, fair-use cap, UNLIMITED_DAILY_LIMIT, /v1/me unlimited_until, admin badge. Migration 0014 removes the 'unlimited' entitlements; old orders of it are skipped in the header. - New prices: single 2 000 Ft, couple 4 500, family 8 000, +1 synastry 2 500, +5 persons 1 500 (list prices 2 000 / 2 500 / 300). - Login page, packages page and the analysis offer say the analyses are written by top AI models, close to a professional astrologer's written reading, for a fraction of the price (the packages page names the model). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
@@ -32,8 +32,7 @@ pub async fn me(State(state): St, auth: AuthUser) -> ApiResult<Json<Value>> {
|
||||
let balance = credits::balance(&mut conn, auth.id()).await?;
|
||||
let birth_change = crate::birth_changes::view(&mut conn, &auth).await?;
|
||||
let persons = crate::persons::slots(&mut conn, &auth, state.config.free_person_slots).await?;
|
||||
let unlimited = crate::packages::unlimited_until(&mut conn, auth.id()).await?;
|
||||
let package = crate::packages::current(&mut conn, auth.id(), unlimited).await?;
|
||||
let package = crate::packages::current(&mut conn, auth.id()).await?;
|
||||
Ok(Json(json!({
|
||||
"user": UserView::from(&auth.user),
|
||||
"providers": providers.into_iter().map(|(p,)| p).collect::<Vec<_>>(),
|
||||
@@ -41,7 +40,6 @@ pub async fn me(State(state): St, auth: AuthUser) -> ApiResult<Json<Value>> {
|
||||
"analyses_left": balance.view(),
|
||||
"birth_change": birth_change,
|
||||
"persons": persons.view(),
|
||||
"unlimited_until": rfc3339_opt(unlimited),
|
||||
"package": package.map(|(p, since)| json!({ "id": p.id, "name": p.name, "since": rfc3339(since) })),
|
||||
})))
|
||||
}
|
||||
|
||||
@@ -33,26 +33,12 @@ pub async fn list_users(
|
||||
let limit = query.limit.unwrap_or(50).clamp(1, 200);
|
||||
let offset = query.offset.unwrap_or(0).max(0);
|
||||
let pattern = query.q.as_deref().map(|q| format!("%{}%", q.trim().replace(['%', '_'], "")));
|
||||
type Row = (
|
||||
Uuid,
|
||||
String,
|
||||
Option<String>,
|
||||
Vec<String>,
|
||||
bool,
|
||||
OffsetDateTime,
|
||||
Option<OffsetDateTime>,
|
||||
i64,
|
||||
i64,
|
||||
i64,
|
||||
Option<OffsetDateTime>,
|
||||
);
|
||||
type Row = (Uuid, String, Option<String>, Vec<String>, bool, OffsetDateTime, Option<OffsetDateTime>, i64, i64, i64);
|
||||
let rows: Vec<Row> = sqlx::query_as(
|
||||
"SELECT u.id, u.email, u.display_name, u.roles, u.email_verified_at IS NOT NULL, u.created_at, u.last_login_at, \
|
||||
(SELECT count(*) FROM charts c WHERE c.owner_id = u.id), \
|
||||
(SELECT COALESCE(SUM(delta), 0)::bigint FROM credit_ledger l WHERE l.user_id = u.id AND l.unit = 'natal'), \
|
||||
(SELECT COALESCE(SUM(delta), 0)::bigint FROM credit_ledger l WHERE l.user_id = u.id AND l.unit = 'synastry'), \
|
||||
(SELECT e.expires_at FROM entitlements e \
|
||||
WHERE e.user_id = u.id AND e.entitlement = 'unlimited' AND e.expires_at > now()) \
|
||||
(SELECT COALESCE(SUM(delta), 0)::bigint FROM credit_ledger l WHERE l.user_id = u.id AND l.unit = 'synastry') \
|
||||
FROM users u \
|
||||
WHERE $1::text IS NULL OR u.email ILIKE $1 OR u.display_name ILIKE $1 \
|
||||
ORDER BY u.created_at DESC LIMIT $2 OFFSET $3",
|
||||
@@ -64,12 +50,11 @@ pub async fn list_users(
|
||||
.await?;
|
||||
let users: Vec<Value> = rows
|
||||
.into_iter()
|
||||
.map(|(id, email, name, roles, verified, created, last_login, charts, natal, synastry, unlimited)| {
|
||||
.map(|(id, email, name, roles, verified, created, last_login, charts, natal, synastry)| {
|
||||
json!({
|
||||
"id": id, "email": email, "display_name": name, "roles": roles, "email_verified": verified,
|
||||
"created_at": rfc3339(created), "last_login_at": rfc3339_opt(last_login),
|
||||
"charts": charts, "analyses_left": {"natal": natal, "synastry": synastry},
|
||||
"unlimited_until": rfc3339_opt(unlimited),
|
||||
})
|
||||
})
|
||||
.collect();
|
||||
@@ -167,14 +152,13 @@ pub async fn grant_package(
|
||||
let mut tx = state.db.begin().await?;
|
||||
let order = packages::grant(&mut tx, id, package, Source::Admin, Some(admin.id()), note.as_deref()).await?;
|
||||
let balance = credits::balance(&mut tx, id).await?;
|
||||
let unlimited = packages::unlimited_until(&mut tx, id).await?;
|
||||
tx.commit().await?;
|
||||
tracing::info!(admin = %admin.id(), user = %id, package = package.id, "package granted");
|
||||
Ok((
|
||||
StatusCode::CREATED,
|
||||
Json(json!({
|
||||
"order_id": order, "user_id": id, "package": package.id,
|
||||
"analyses_left": balance.view(), "unlimited_until": rfc3339_opt(unlimited),
|
||||
"analyses_left": balance.view(),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ use crate::AppState;
|
||||
use crate::auth::AuthUser;
|
||||
use crate::credits::{self, Unit};
|
||||
use crate::error::{ApiError, ApiResult};
|
||||
use crate::packages;
|
||||
use crate::views::{rfc3339, rfc3339_opt, sha256_hex};
|
||||
use db::Role;
|
||||
|
||||
@@ -119,18 +118,10 @@ 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 and a running unlimited package (within its daily cap) use no unit.
|
||||
// Admins use no unit.
|
||||
let admin = auth.user.has_role(Role::Admin);
|
||||
let unlimited = !admin && {
|
||||
let mut conn = state.db.acquire().await?;
|
||||
let until = packages::unlimited_until(&mut conn, auth.id()).await?;
|
||||
if until.is_some() {
|
||||
packages::check_fair_use(&mut conn, auth.id(), state.config.unlimited_daily_limit).await?;
|
||||
}
|
||||
until.is_some()
|
||||
};
|
||||
let unit = match target {
|
||||
_ if admin || unlimited => None,
|
||||
_ if admin => None,
|
||||
Target::Synastry { .. } => Some(Unit::Synastry),
|
||||
_ => Some(Unit::Natal),
|
||||
};
|
||||
|
||||
@@ -138,7 +138,6 @@ async fn public_config(State(state): St) -> Json<Value> {
|
||||
"summary_model": c.summary_model,
|
||||
"password_login": c.password_login,
|
||||
"mock_payments": c.mock_payments,
|
||||
"unlimited_daily_limit": c.unlimited_daily_limit,
|
||||
"signup_mode": c.signup_mode.as_str(),
|
||||
"password_min_length": crate::auth::MIN_PASSWORD_LEN,
|
||||
}))
|
||||
|
||||
@@ -14,7 +14,6 @@ use crate::credits::{self, Unit};
|
||||
use crate::error::{ApiError, ApiResult};
|
||||
use crate::packages::{self, CATALOG, Source};
|
||||
use crate::persons;
|
||||
use crate::views::rfc3339;
|
||||
|
||||
/// The package catalog (public).
|
||||
pub async fn catalog() -> Json<Value> {
|
||||
@@ -30,16 +29,14 @@ pub struct MockPayment {
|
||||
unit: Option<Unit>,
|
||||
}
|
||||
|
||||
/// What the user has now: units left, person slots, the unlimited package.
|
||||
/// What the user has now: units left and person slots.
|
||||
pub async fn holdings(state: &crate::AppState, auth: &AuthUser) -> Result<Value, ApiError> {
|
||||
let mut conn = state.db.acquire().await?;
|
||||
let balance = credits::balance(&mut conn, auth.id()).await?;
|
||||
let persons = persons::slots(&mut conn, auth, state.config.free_person_slots).await?;
|
||||
let until = packages::unlimited_until(&mut conn, auth.id()).await?;
|
||||
Ok(json!({
|
||||
"analyses_left": balance.view(),
|
||||
"persons": persons.view(),
|
||||
"unlimited_until": until.map(rfc3339),
|
||||
}))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user