games_app/backend/dist/repositories/withdrawalLockRepository.d.ts
2026-06-29 15:01:23 +02:00

35 lines
1.5 KiB
TypeScript

/**
* Repository for withdrawal balance locks.
* Reserves funds while a withdrawal is pending to prevent double-spending.
*/
/**
* Creates a withdrawal lock for a user and wallet type.
* @param data - Lock details to persist.
* @param data.userId - ID of the user whose funds are locked.
* @param data.walletTypeId - Wallet type the lock applies to.
* @param data.transactionId - Associated transaction ID, or null for pre-transaction locks.
* @param data.amount - Amount locked in the smallest currency unit.
* @param data.expiresAt - Optional expiration time after which the lock may be released.
* @returns Resolves when the lock row has been inserted.
*/
export declare function create(data: {
userId: string;
walletTypeId: number;
transactionId: string | null;
amount: bigint;
expiresAt?: Date | null;
}): Promise<void>;
/**
* Removes a withdrawal lock by its associated transaction ID.
* @param transactionId - ID of the transaction whose lock should be released.
* @returns Resolves when matching lock rows have been deleted.
*/
export declare function deleteByTransactionId(transactionId: string): Promise<void>;
/**
* Sums all active locked amounts for a user and wallet type.
* @param userId - ID of the user to query.
* @param walletTypeId - Wallet type to sum locks for.
* @returns Total locked amount in the smallest currency unit.
*/
export declare function getLockedAmount(userId: string, walletTypeId: number): Promise<bigint>;
//# sourceMappingURL=withdrawalLockRepository.d.ts.map