Я делаю два вызова репозитория для обновления данных в двух разных таблицах в db. Я хочу осуществить транзакцию. Нужна помощь в том, как это сделать. https://loopback.io/doc/en/lb4/Using-database-transactions.html Судя по документации, транзакция может выполняться только в одном репозитории, а не между двумя репозиториями.
const created = await repo.create({title: 'Groceries'}, {transaction: tx});
const updated = await repo.update(
{title: 'Errands', id: created.id},
{transaction: tx},
);
// commit the transaction to persist the changes
await tx.commit();
Но я хочу
const created = await repo1.create({title: 'Groceries'}, {transaction: tx});
const updated = await repo2.update(
{title: 'Errands', id: created.id},
{transaction: tx},
);
// commit the transaction to persist the changes
await tx.commit();
Кто-нибудь знает, как это сделать.