How to use the cozy-doctypes.BankTransaction.bulkSave function in cozy-doctypes

To help you get started, we’ve selected a few cozy-doctypes examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cozy / cozy.github.io / en / cozy-banks / src / ducks / categorization / services.js View on Github external
export const categorizeChunk = async (categorizer, chunk) => {
  const timeStart = new Date()
  const categorizedTransactions = categorizer.categorize(chunk)
  categorizedTransactions.forEach(t => (t.toCategorize = false))

  await BankTransaction.bulkSave(categorizedTransactions, 30)

  sendResultsToMatomo(categorizedTransactions)

  const timeEnd = new Date()
  const timeElapsed = differenceInSeconds(timeEnd, timeStart)

  return timeElapsed
}