Fix before hook items transaction (#5136)

Since we might need information from database, we must provide the
current transaction, instead of the connection.
Otherwise, databases like SQLite which only accepts a single connection
will throw an error of knex timeout.

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
This commit is contained in:
José Varela
2021-04-19 16:34:18 +01:00
committed by GitHub
parent e8bacfbae1
commit 7fbba272ad

View File

@@ -70,7 +70,7 @@ export class ItemsService<Item extends AnyItem = AnyItem> implements AbstractSer
action: 'create',
payload: payloads[i],
schema: this.schema,
database: this.knex,
database: trx,
});
if (customProcessed && customProcessed.length > 0) {