Skip to content

Commit

Permalink
Sycn
Browse files Browse the repository at this point in the history
  • Loading branch information
pontusab committed Mar 8, 2024
1 parent 9b60c9b commit 8c7b662
Showing 1 changed file with 20 additions and 13 deletions.
33 changes: 20 additions & 13 deletions packages/jobs/src/transactions/sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,31 @@ client.defineJob({
return;
}

const transactions = await provider.getTransactions({
return provider.getTransactions({
teamId: account.team_id,
accountId: account.account_id,
accessToken: account.bank_connection?.access_token,
bankAccountId: account.id,
});

await io.logger.debug("transactions", transactions);

// NOTE: We will get all the transactions at once for each account so
// we need to guard against massive payloads
// const { error, data: transactionsData } = await supabase
// .from("decrypted_transactions")
// .upsert(transactions, {
// onConflict: "internal_id",
// ignoreDuplicates: true,
// })
// .select("*, name:decrypted_name");
});

try {
if (promises) {
const transactions = await Promise.all(promises);
await io.logger.debug("Transactions", transactions);
}
} catch (error) {
await io.logger.error(JSON.stringify(error, null, 2));
}

// NOTE: We will get all the transactions at once for each account so
// we need to guard against massive payloads
// const { error, data: transactionsData } = await supabase
// .from("decrypted_transactions")
// .upsert(transactions, {
// onConflict: "internal_id",
// ignoreDuplicates: true,
// })
// .select("*, name:decrypted_name");
},
});

0 comments on commit 8c7b662

Please sign in to comment.