Skip to content

Commit 935d539

Browse files
committed
fix undefined where conditions
1 parent 610c180 commit 935d539

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

packages/runtime/src/enhancements/node/policy/handler.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -1579,12 +1579,15 @@ export class PolicyProxyHandler<DbClient extends DbClientContract> implements Pr
15791579
if (this.shouldLogQuery) {
15801580
this.logger.info(
15811581
`[policy] \`findMany\` ${this.model}: ${formatObject({
1582-
where: args.where,
1582+
where: args.where ?? {},
15831583
select: candidateSelect,
15841584
})}`
15851585
);
15861586
}
1587-
const candidates = await tx[this.model].findMany({ where: args.where, select: candidateSelect });
1587+
const candidates = await tx[this.model].findMany({
1588+
where: args.where ?? {},
1589+
select: candidateSelect,
1590+
});
15881591

15891592
// build a ID filter based on id values filtered by the additional checker
15901593
const { idFilter } = this.buildIdFilterWithEntityChecker(candidates, entityChecker.func);

packages/server/src/api/rest/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ class RequestHandler extends APIHandlerBase {
678678
args.take = limit;
679679
const [entities, count] = await Promise.all([
680680
prisma[type].findMany(args),
681-
prisma[type].count({ where: args.where }),
681+
prisma[type].count({ where: args.where ?? {} }),
682682
]);
683683
const total = count as number;
684684

0 commit comments

Comments
 (0)