mirror of
https://github.com/strapi/strapi.git
synced 2025-11-02 10:55:37 +00:00
apply fixes:
- fix callback return type - fix callback params
This commit is contained in:
parent
81f4a931a9
commit
f0dbb4be31
2
packages/core/database/lib/index.d.ts
vendored
2
packages/core/database/lib/index.d.ts
vendored
@ -168,7 +168,7 @@ export interface Database {
|
||||
trx: Knex.Transaction;
|
||||
rollback: () => Promise<void>;
|
||||
commit: () => Promise<void>;
|
||||
}) => Promise<void>
|
||||
}) => Promise<unknown>
|
||||
):
|
||||
| Promise<unknown>
|
||||
| { get: () => Knex.Transaction; rollback: () => Promise<void>; commit: () => Promise<void> };
|
||||
|
||||
@ -76,9 +76,10 @@ class Database {
|
||||
};
|
||||
}
|
||||
|
||||
return transactionCtx.run({ trx, commit, rollback }, async () => {
|
||||
return transactionCtx.run(trx, async () => {
|
||||
try {
|
||||
const res = await cb(trx);
|
||||
const callbackParams = { trx, commit, rollback };
|
||||
const res = await cb(callbackParams);
|
||||
await commit();
|
||||
return res;
|
||||
} catch (error) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user