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
+4 -4
View File
@@ -49,8 +49,8 @@ pub struct Config {
pub max_charts_per_user: i64,
/// `FREE_PERSON_SLOTS` (default 0): persons a user may add without a package.
pub free_person_slots: i64,
/// `PERSON_PACK_SIZE` (default 5): persons in one person package.
pub person_pack_size: i64,
/// `UNLIMITED_DAILY_LIMIT` (default 5): new detailed analyses a day with the unlimited package.
pub unlimited_daily_limit: i64,
}
fn var(name: &str) -> Option<String> {
@@ -105,7 +105,7 @@ impl Config {
prompt_version: var("ANALYSIS_PROMPT_VERSION").unwrap_or_else(|| "v2".into()),
max_charts_per_user: parsed("MAX_CHARTS_PER_USER", 1000)?,
free_person_slots: parsed("FREE_PERSON_SLOTS", 0)?,
person_pack_size: parsed("PERSON_PACK_SIZE", 5)?,
unlimited_daily_limit: parsed("UNLIMITED_DAILY_LIMIT", 5)?,
};
if config.session_ttl_days < 1 {
bail!("SESSION_TTL_DAYS must be at least 1");
@@ -135,7 +135,7 @@ impl Config {
prompt_version: "v1".into(),
max_charts_per_user: 50,
free_person_slots: 5,
person_pack_size: 5,
unlimited_daily_limit: 3,
}
}
}