diff --git a/docs/docs/06_plugins/01_available-plugins/01-transactional/04-pg-promise-adapter.md b/docs/docs/06_plugins/01_available-plugins/01-transactional/04-pg-promise-adapter.md index 34176ec4..56a8818f 100644 --- a/docs/docs/06_plugins/01_available-plugins/01-transactional/04-pg-promise-adapter.md +++ b/docs/docs/06_plugins/01_available-plugins/01-transactional/04-pg-promise-adapter.md @@ -57,8 +57,6 @@ ClsModule.forRoot({ The `tx` property on the `TransactionHost` is typed as [`Database`](https://vitaly-t.github.io/pg-promise/Database.html). -`@Transactional()` takes an optional argument that is the same as the `option` argument to `Database.tx()` in `pg-promise` ([docs](https://vitaly-t.github.io/pg-promise/Database.html#tx)). - ## Example ```ts title="user.service.ts" diff --git a/packages/transactional-adapters/transactional-adapter-pg-promise/src/lib/transactional-adapter-pg-promise.ts b/packages/transactional-adapters/transactional-adapter-pg-promise/src/lib/transactional-adapter-pg-promise.ts index 0cb1f35b..7a92fb8b 100644 --- a/packages/transactional-adapters/transactional-adapter-pg-promise/src/lib/transactional-adapter-pg-promise.ts +++ b/packages/transactional-adapters/transactional-adapter-pg-promise/src/lib/transactional-adapter-pg-promise.ts @@ -11,6 +11,10 @@ export interface PgPromiseTransactionalAdapterOptions { */ dbInstanceToken: any; + /** + * Default options for the transaction. These will be merged with any transaction-specific options + * passed to the `@Transactional` decorator or the `TransactionHost#withTransaction` method. + */ defaultTxOptions?: TxOptions; } @@ -33,7 +37,7 @@ export class TransactionalAdapterPgPromise setClient: (client?: Database) => void, ) => { return pgPromiseDbInstance.tx( - options ?? this.defaultTxOptions ?? {}, + { ...this.defaultTxOptions, ...options }, (tx) => { setClient(tx as unknown as Database); return fn();