Skip to content
This repository was archived by the owner on May 25, 2025. It is now read-only.

Commit 7bac32c

Browse files
fix: propagate opt in CommonDao.* correctly, so readAt is respected
credit to @ryangibbsnc for spotting it
1 parent 548390b commit 7bac32c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/commondao/common.dao.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export class CommonDao<BM extends BaseDBEntity, DBM extends BaseDBEntity = BM, I
123123
const table = opt.table || this.cfg.table
124124
const started = this.logStarted(op, table)
125125

126-
let dbm = (await (opt.tx || this.cfg.db).getByIds<DBM>(table, [id as string]))[0]
126+
let dbm = (await (opt.tx || this.cfg.db).getByIds<DBM>(table, [id as string], opt))[0]
127127
if (dbm && this.cfg.hooks!.afterLoad) {
128128
dbm = (await this.cfg.hooks!.afterLoad(dbm)) || undefined
129129
}
@@ -147,7 +147,7 @@ export class CommonDao<BM extends BaseDBEntity, DBM extends BaseDBEntity = BM, I
147147
const op = `getByIdAsDBM(${id})`
148148
const table = opt.table || this.cfg.table
149149
const started = this.logStarted(op, table)
150-
let [dbm] = await (opt.tx || this.cfg.db).getByIds<DBM>(table, [id as string])
150+
let [dbm] = await (opt.tx || this.cfg.db).getByIds<DBM>(table, [id as string], opt)
151151
if (dbm && this.cfg.hooks!.afterLoad) {
152152
dbm = (await this.cfg.hooks!.afterLoad(dbm)) || undefined
153153
}
@@ -162,7 +162,7 @@ export class CommonDao<BM extends BaseDBEntity, DBM extends BaseDBEntity = BM, I
162162
const op = `getByIds ${ids.length} id(s) (${_truncate(ids.slice(0, 10).join(', '), 50)})`
163163
const table = opt.table || this.cfg.table
164164
const started = this.logStarted(op, table)
165-
let dbms = await (opt.tx || this.cfg.db).getByIds<DBM>(table, ids as string[])
165+
let dbms = await (opt.tx || this.cfg.db).getByIds<DBM>(table, ids as string[], opt)
166166
if (this.cfg.hooks!.afterLoad && dbms.length) {
167167
dbms = (await pMap(dbms, async dbm => await this.cfg.hooks!.afterLoad!(dbm))).filter(
168168
_isTruthy,
@@ -179,7 +179,7 @@ export class CommonDao<BM extends BaseDBEntity, DBM extends BaseDBEntity = BM, I
179179
const op = `getByIdsAsDBM ${ids.length} id(s) (${_truncate(ids.slice(0, 10).join(', '), 50)})`
180180
const table = opt.table || this.cfg.table
181181
const started = this.logStarted(op, table)
182-
let dbms = await (opt.tx || this.cfg.db).getByIds<DBM>(table, ids as string[])
182+
let dbms = await (opt.tx || this.cfg.db).getByIds<DBM>(table, ids as string[], opt)
183183
if (this.cfg.hooks!.afterLoad && dbms.length) {
184184
dbms = (await pMap(dbms, async dbm => await this.cfg.hooks!.afterLoad!(dbm))).filter(
185185
_isTruthy,

0 commit comments

Comments
 (0)