Packages: from one analysis to unlimited, admin can give them
CI / test (push) Successful in 47s
CI / build (push) Successful in 4m19s
CI / deploy (push) Skipped

A fixed catalog (packages.rs, reasoning in docs/csomagok.md): Egy elemzés
2 990 Ft, Páros 6 990 Ft, Család 11 990 Ft (featured), Korlátlan 17 990 Ft
for a year, and two top-ups. Every grant is a package_orders row; units are
credit_ledger rows with reason 'package' and never expire. The unlimited
package is a time-limited 'unlimited' entitlement: analyses use no unit and
persons have no limit, with a daily fair-use cap (UNLIMITED_DAILY_LIMIT, 5);
buying it again extends it by a year.

- GET /v1/packages, mock payment by package id, /v1/me unlimited_until
- POST /v1/admin/users/{id}/packages: give a package as a gift
- /csomagok page; the paid step of an analysis offers three packages with
  the bigger one featured; person packs use the catalog; admin user list
  has a package column
- PERSON_PACK_SIZE is replaced by the catalog's +5 személy top-up

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 16:19:20 +00:00
co-authored by Claude Opus 5.5
parent 0bd5c39080
commit e004ea696b
29 changed files with 1019 additions and 164 deletions
+3 -1
View File
@@ -50,6 +50,7 @@ pub fn router(state: Arc<AppState>) -> Router {
Router::new()
.route("/healthz", get(health))
.route("/v1/config", get(public_config))
.route("/v1/packages", get(payments::catalog))
// login
.route("/v1/auth/register", post(auth::register))
.route("/v1/auth/login", post(auth::login))
@@ -90,6 +91,7 @@ pub fn router(state: Arc<AppState>) -> Router {
.route("/v1/admin/users", get(admin::list_users))
.route("/v1/admin/users/{id}", patch(admin::update_user))
.route("/v1/admin/users/{id}/credits", post(admin::adjust_credits))
.route("/v1/admin/users/{id}/packages", post(admin::grant_package))
.route("/v1/admin/prompts", get(prompts::list))
.route("/v1/admin/prompts/{kind}/{language}", axum::routing::put(prompts::save))
.route("/v1/admin/prompts/{kind}/{language}/preview", post(prompts::start_preview))
@@ -127,7 +129,7 @@ async fn public_config(State(state): St) -> Json<Value> {
"summary_model": c.summary_model,
"password_login": c.password_login,
"mock_payments": c.mock_payments,
"person_pack_size": c.person_pack_size,
"unlimited_daily_limit": c.unlimited_daily_limit,
"password_min_length": crate::auth::MIN_PASSWORD_LEN,
}))
}