Skip to content

Commit 2ee868f

Browse files
committed
update
1 parent 35517a1 commit 2ee868f

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,7 @@ export class PolicyProxyHandler<DbClient extends DbClientContract> implements Pr
483483
const updatedArgs = {
484484
...args,
485485
select: this.policyUtils.makeIdSelection(this.model),
486+
include: undefined,
486487
};
487488
const created = await this.modelClient.createManyAndReturn(updatedArgs);
488489

tests/integration/tests/enhancements/with-policy/create-many-and-return.test.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,17 @@ describe('Test API createManyAndReturn', () => {
9292

9393
const db = enhance();
9494

95-
// create should succeed but one result can't be read back
96-
await expect(
97-
db.post.createManyAndReturn({
98-
data: [
99-
{ title: 'post1', published: true },
100-
{ title: 'post2', published: false },
101-
],
102-
})
103-
).toBeRejectedByPolicy();
95+
// create should succeed but one result's title field can't be read back
96+
const r = await db.post.createManyAndReturn({
97+
data: [
98+
{ title: 'post1', published: true },
99+
{ title: 'post2', published: false },
100+
],
101+
});
102+
103+
expect(r.length).toBe(2);
104+
expect(r[0].title).toBeTruthy();
105+
expect(r[1].title).toBeUndefined();
104106

105107
// check posts are created
106108
await expect(prisma.post.findMany()).resolves.toHaveLength(2);

0 commit comments

Comments
 (0)