diff options
Diffstat (limited to 'packages/taler-wallet-core/src/attention.ts')
-rw-r--r-- | packages/taler-wallet-core/src/attention.ts | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/packages/taler-wallet-core/src/attention.ts b/packages/taler-wallet-core/src/attention.ts index 61f95350d..60d2117f1 100644 --- a/packages/taler-wallet-core/src/attention.ts +++ b/packages/taler-wallet-core/src/attention.ts @@ -29,15 +29,15 @@ import { UserAttentionsResponse, } from "@gnu-taler/taler-util"; import { timestampPreciseFromDb, timestampPreciseToDb } from "./db.js"; -import { InternalWalletState } from "./wallet.js"; +import { InternalWalletState, WalletExecutionContext } from "./wallet.js"; const logger = new Logger("operations/attention.ts"); export async function getUserAttentionsUnreadCount( - ws: InternalWalletState, + wex: WalletExecutionContext, req: UserAttentionsRequest, ): Promise<UserAttentionsCountResponse> { - const total = await ws.db.runReadOnlyTx(["userAttention"], async (tx) => { + const total = await wex.db.runReadOnlyTx(["userAttention"], async (tx) => { let count = 0; await tx.userAttention.iter().forEach((x) => { if ( @@ -56,10 +56,10 @@ export async function getUserAttentionsUnreadCount( } export async function getUserAttentions( - ws: InternalWalletState, + wex: WalletExecutionContext, req: UserAttentionsRequest, ): Promise<UserAttentionsResponse> { - return await ws.db.runReadOnlyTx(["userAttention"], async (tx) => { + return await wex.db.runReadOnlyTx(["userAttention"], async (tx) => { const pending: UserAttentionUnreadList = []; await tx.userAttention.iter().forEach((x) => { if ( @@ -79,10 +79,10 @@ export async function getUserAttentions( } export async function markAttentionRequestAsRead( - ws: InternalWalletState, + wex: WalletExecutionContext, req: UserAttentionByIdRequest, ): Promise<void> { - await ws.db.runReadWriteTx(["userAttention"], async (tx) => { + await wex.db.runReadWriteTx(["userAttention"], async (tx) => { const ua = await tx.userAttention.get([req.entityId, req.type]); if (!ua) throw Error("attention request not found"); tx.userAttention.put({ @@ -96,15 +96,15 @@ export async function markAttentionRequestAsRead( * the wallet need the user attention to complete a task * internal API * - * @param ws + * @param wex * @param info */ export async function addAttentionRequest( - ws: InternalWalletState, + wex: WalletExecutionContext, info: AttentionInfo, entityId: string, ): Promise<void> { - await ws.db.runReadWriteTx(["userAttention"], async (tx) => { + await wex.db.runReadWriteTx(["userAttention"], async (tx) => { await tx.userAttention.put({ info, entityId, @@ -118,14 +118,14 @@ export async function addAttentionRequest( * user completed the task, attention request is not needed * internal API * - * @param ws + * @param wex * @param created */ export async function removeAttentionRequest( - ws: InternalWalletState, + wex: WalletExecutionContext, req: UserAttentionByIdRequest, ): Promise<void> { - await ws.db.runReadWriteTx(["userAttention"], async (tx) => { + await wex.db.runReadWriteTx(["userAttention"], async (tx) => { const ua = await tx.userAttention.get([req.entityId, req.type]); if (!ua) throw Error("attention request not found"); await tx.userAttention.delete([req.entityId, req.type]); |