mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-06-30 21:59:46 +02:00
feat(refactor): refactor payment system to implement unified credit wallet.
- Updated environment variables and - configurations for credit purchases via Stripe, replacing legacy page pack system. - Introduced auto-reload feature for credit top-ups and modified database models to track credit transactions. - Updated notification system to handle insufficient credits and auto-reload failures. - Adjusted API routes and schemas to reflect changes in credit management.
This commit is contained in:
parent
4fe216856d
commit
a7407502d3
88 changed files with 3229 additions and 2261 deletions
|
|
@ -3,18 +3,16 @@ import { number, string, table } from "@rocicorp/zero";
|
|||
/**
|
||||
* Live-meter slice of the ``user`` table replicated through Zero.
|
||||
*
|
||||
* ``premiumCreditMicrosLimit`` / ``premiumCreditMicrosUsed`` are stored
|
||||
* as integer micro-USD (1_000_000 == $1.00). UI consumers divide by 1M
|
||||
* when displaying. Sensitive fields (email, hashed_password, oauth, etc.)
|
||||
* are intentionally omitted via the Postgres column-list publication so
|
||||
* they never enter WAL replication.
|
||||
* ``creditMicrosBalance`` is stored as integer micro-USD (1_000_000 == $1.00);
|
||||
* UI consumers divide by 1M when displaying and clamp at $0.00 (the balance can
|
||||
* dip slightly negative when actual cost exceeds the pre-charge estimate).
|
||||
* Sensitive fields (email, hashed_password, oauth, etc.) are intentionally
|
||||
* omitted via the Postgres column-list publication so they never enter WAL
|
||||
* replication.
|
||||
*/
|
||||
export const userTable = table("user")
|
||||
.columns({
|
||||
id: string(),
|
||||
pagesLimit: number().from("pages_limit"),
|
||||
pagesUsed: number().from("pages_used"),
|
||||
premiumCreditMicrosLimit: number().from("premium_credit_micros_limit"),
|
||||
premiumCreditMicrosUsed: number().from("premium_credit_micros_used"),
|
||||
creditMicrosBalance: number().from("credit_micros_balance"),
|
||||
})
|
||||
.primaryKey("id");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue