Drop the unlimited package, new prices, AI quality note
CI / test (push) Successful in 53s
CI / build (push) Successful in 6m41s
CI / deploy (push) Skipped

- 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:
feco
2026-11-18 06:20:31 +00:00
co-authored by Claude Opus 5.5
parent 742b88183b
commit 6d2ad4aa0c
27 changed files with 147 additions and 280 deletions
+19 -42
View File
@@ -783,9 +783,9 @@ async fn persons_use_package_slots(pool: PgPool) {
app.chart(&anna, "Dani", false, "1987-01-01").await;
assert_eq!(persons(app.get("/v1/me", Some(&anna)).await.body)["left"], 3);
// the unlimited package
let r = app.post("/v1/payments/mock", Some(&anna), json!({"package": "unlimited"})).await;
assert_eq!(r.body["persons"], json!({"used": 3, "limit": null, "left": null, "unlimited": true}));
// the family package adds five more
let r = app.post("/v1/payments/mock", Some(&anna), json!({"package": "family"})).await;
assert_eq!(r.body["persons"], json!({"used": 3, "limit": 11, "left": 8, "unlimited": false}));
app.chart(&anna, "Emma", false, "1988-01-01").await;
let list = app.get("/v1/charts", Some(&anna)).await.body;
let kinds: Vec<&str> = list["charts"].as_array().unwrap().iter().map(|c| c["kind"].as_str().unwrap()).collect();
@@ -995,7 +995,7 @@ async fn grant_package(app: &TestApp, token: &str, user: &str, package: &str) ->
}
#[sqlx::test(migrator = "db::MIGRATOR")]
async fn packages_grant_units_and_unlimited(pool: PgPool) {
async fn packages_grant_units(pool: PgPool) {
let app = TestApp::new(pool.clone()).await;
let admin = app.register("admin@example.com", "Admin").await;
let anna = app.register("anna@example.com", "Anna").await;
@@ -1005,10 +1005,10 @@ async fn packages_grant_units_and_unlimited(pool: PgPool) {
// the catalog is public
let r = app.get("/v1/packages", None).await;
let ids: Vec<&str> = r.body["packages"].as_array().unwrap().iter().map(|p| p["id"].as_str().unwrap()).collect();
assert_eq!(ids, ["single", "couple", "family", "unlimited", "addon_synastry", "addon_persons"]);
assert_eq!(ids, ["single", "couple", "family", "addon_synastry", "addon_persons"]);
assert_eq!(
(&r.body["packages"][2]["badge"], &r.body["packages"][2]["per_analysis_huf"]),
(&json!("Legnépszerűbb"), &json!(1090))
(&json!("Legnépszerűbb"), &json!(727))
);
// an admin gives a package as a gift
@@ -1022,7 +1022,7 @@ async fn packages_grant_units_and_unlimited(pool: PgPool) {
r.body
);
let me = app.get("/v1/me", Some(&anna)).await.body;
assert_eq!((&me["persons"]["limit"], &me["unlimited_until"]), (&json!(10), &Value::Null)); // 5 free + 5
assert_eq!(me["persons"]["limit"], 10); // 5 free + 5
let (source, price): (String, i32) =
sqlx::query_as("SELECT source, price_huf FROM package_orders WHERE package = 'family'")
.fetch_one(&pool)
@@ -1035,45 +1035,22 @@ async fn packages_grant_units_and_unlimited(pool: PgPool) {
assert_eq!(r.body["analyses_left"], json!({"natal": 8, "synastry": 6}), "{}", r.body);
let (price,): (i32,) =
sqlx::query_as("SELECT price_huf FROM package_orders WHERE package = 'couple'").fetch_one(&pool).await.unwrap();
assert_eq!(price, 6990);
assert_eq!(price, 4500);
// the header shows the latest main package; a top-up does not change it
app.post("/v1/payments/mock", Some(&anna), json!({"package": "addon_persons"})).await;
assert_eq!(app.get("/v1/me", Some(&anna)).await.body["package"]["name"], "Páros");
// unlimited: a year, and a second one extends it
let bela = app.register("bela@example.com", "Béla").await;
let bela_id = app.get("/v1/me", Some(&bela)).await.body["user"]["id"].as_str().unwrap().to_string();
grant_package(&app, &admin, &bela_id, "unlimited").await;
let r = grant_package(&app, &admin, &bela_id, "unlimited").await;
let until = time::OffsetDateTime::parse(
r.body["unlimited_until"].as_str().unwrap(),
&time::format_description::well_known::Rfc3339,
)
.unwrap();
let days = (until - time::OffsetDateTime::now_utc()).whole_days();
assert!((725..=733).contains(&days), "{days}");
assert_eq!(app.get("/v1/me", Some(&bela)).await.body["persons"]["unlimited"], true);
assert_eq!(app.get("/v1/me", Some(&bela)).await.body["package"]["id"], "unlimited");
// analyses use no unit, up to the daily cap (3 in tests)
for (i, date) in ["1980-01-01", "1981-01-01", "1982-01-01"].into_iter().enumerate() {
let chart = app.chart(&bela, &format!("P{i}"), i == 0, date).await;
let r = app
.call("POST", &format!("/v1/charts/{}/analyses", chart["id"].as_str().unwrap()), Some(&bela), None)
.await;
assert_eq!((r.status, &r.body["credits_charged"]), (StatusCode::ACCEPTED, &json!(0)), "{}", r.body);
}
let fourth = app.chart(&bela, "P3", false, "1983-01-01").await;
let uri = format!("/v1/charts/{}/analyses", fourth["id"].as_str().unwrap());
let r = app.call("POST", &uri, Some(&bela), None).await;
assert_eq!((r.status, r.body["error"]["code"].as_str()), (StatusCode::TOO_MANY_REQUESTS, Some("fair_use_limit")));
// after it ends, units are needed again
sqlx::query("UPDATE entitlements SET expires_at = now() - interval '1 day'").execute(&pool).await.unwrap();
let r = app.call("POST", &uri, Some(&bela), None).await;
assert_eq!(r.status, StatusCode::PAYMENT_REQUIRED);
assert_eq!(app.get("/v1/me", Some(&bela)).await.body["unlimited_until"], Value::Null);
assert_eq!(app.get("/v1/me", Some(&bela)).await.body["package"], Value::Null); // ended
// the unlimited package is not sold any more; an old order of it is skipped
let r = app.post("/v1/payments/mock", Some(&anna), json!({"package": "unlimited"})).await;
assert_eq!(r.status, StatusCode::NOT_FOUND);
assert_eq!(grant_package(&app, &admin, &anna_id, "unlimited").await.status, StatusCode::NOT_FOUND);
sqlx::query("INSERT INTO package_orders (id, user_id, package, source) VALUES ($1, $2::uuid, 'unlimited', 'mock')")
.bind(uuid::Uuid::now_v7())
.bind(&anna_id)
.execute(&pool)
.await
.unwrap();
assert_eq!(app.get("/v1/me", Some(&anna)).await.body["package"]["name"], "Páros");
}
#[sqlx::test(migrator = "db::MIGRATOR")]