games_app/backend/dist/repositories/ledgerIntegrityRepository.d.ts
2026-11-15 16:14:38 +02:00

43 lines
1.5 KiB
TypeScript

export type LedgerSnapshotRow = {
account_id: string;
available_balance: string;
locked_balance: string;
entries_sum: string;
last_entry_at: Date | null;
snapshot_at: Date;
};
export type AccountLedgerMeta = {
account_id: string;
available_balance: string;
locked_balance: string;
entries_sum: string;
last_entry_at: Date | null;
entry_count: string;
};
export declare function getAccountLedgerMeta(accountId: string): Promise<AccountLedgerMeta | null>;
export declare function getSnapshot(accountId: string): Promise<LedgerSnapshotRow | null>;
export declare function upsertSnapshot(meta: AccountLedgerMeta): Promise<void>;
/**
* Main accounts whose locked_balance does not equal SUM(withdrawal_locks).
* Catches unauthorized available↔locked reshuffles that conserve total balance.
*/
export declare function listLockedReservationMismatches(): Promise<Array<{
account_id: string;
user_id: string;
wallet_type_id: number;
available_balance: string;
locked_balance: string;
entries_sum: string;
locks_sum: string;
}>>;
/** Credits with missing or broken references to authorized source tables. */
export declare function listInvalidLedgerReferences(): Promise<Array<{
account_id: string;
user_id: string;
entry_id: string;
type: string;
amount: string;
issue: string;
}>>;
export declare function checksumBalances(meta: AccountLedgerMeta): string;
//# sourceMappingURL=ledgerIntegrityRepository.d.ts.map