Packages: from one analysis to unlimited, admin can give them
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:
@@ -1,7 +1,7 @@
|
||||
//! Persons: charts of other people (name and birth data) a user adds next to
|
||||
//! their own. Each new person uses one `person` unit, bought in packages;
|
||||
//! deleting a person does not give it back. An unlimited package
|
||||
//! (`unlimited_persons` entitlement) and admins have no limit.
|
||||
//! deleting a person does not give it back. The `unlimited_persons`
|
||||
//! entitlement, a running unlimited package and admins have no limit.
|
||||
//!
|
||||
//! A person's birth data can be corrected within an hour of adding them,
|
||||
//! then it is locked (admins: any time).
|
||||
@@ -53,7 +53,8 @@ pub async fn slots(conn: &mut PgConnection, auth: &AuthUser, free: i64) -> Resul
|
||||
(SELECT COUNT(*) FROM credit_ledger WHERE user_id = $1 AND unit = 'person' AND reason = 'person'), \
|
||||
(SELECT COALESCE(SUM(delta), 0)::bigint FROM credit_ledger \
|
||||
WHERE user_id = $1 AND unit = 'person' AND reason <> 'person'), \
|
||||
EXISTS (SELECT 1 FROM entitlements WHERE user_id = $1 AND entitlement = 'unlimited_persons')",
|
||||
EXISTS (SELECT 1 FROM entitlements WHERE user_id = $1 \
|
||||
AND (entitlement = 'unlimited_persons' OR (entitlement = 'unlimited' AND expires_at > now())))",
|
||||
)
|
||||
.bind(auth.id())
|
||||
.fetch_one(conn)
|
||||
|
||||
Reference in New Issue
Block a user