diff --git a/src/lib/db/transaction.ts b/src/lib/db/transaction.ts index 96e9546c00..9e40a1877f 100644 --- a/src/lib/db/transaction.ts +++ b/src/lib/db/transaction.ts @@ -41,8 +41,8 @@ export type WithTransactional = S & { transactional: (fn: (service: S) => R) => Promise; }; -export type WithRollback = S & { - rollback: (fn: (service: S) => R) => Promise; +export type WithRollbackTransaction = S & { + rollbackTransaction: (fn: (service: S) => R) => Promise; }; /** @@ -86,13 +86,13 @@ export function withTransactional( return service; } -export function withRollback( +export function withRollbackTransaction( serviceFactory: (db: Knex) => S, db: Knex, -): WithRollback { - const service = serviceFactory(db) as WithRollback; +): WithRollbackTransaction { + const service = serviceFactory(db) as WithRollbackTransaction; - service.rollback = async (fn: (service: S) => R) => { + service.rollbackTransaction = async (fn: (service: S) => R) => { const trx = await db.transaction(); try { const transactionService = serviceFactory(trx);