-
-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: incorrect policy injection for nested to-one relation inside a t…
…o-many parent (#777)
- Loading branch information
Showing
4 changed files
with
102 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,7 +71,7 @@ describe('CLI Plugins Tests', () => { | |
'[email protected]', | ||
'react', | ||
'swr', | ||
'@tanstack/react-query', | ||
'@tanstack/react-query@^4.0.0', | ||
'@trpc/server', | ||
'@prisma/client@^4.0.0', | ||
`${path.join(__dirname, '../../../../.build/zenstackhq-language-' + ver + '.tgz')}`, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { loadSchema } from '@zenstackhq/testtools'; | ||
|
||
describe('Regression: issue 764', () => { | ||
it('regression', async () => { | ||
const { prisma, enhance } = await loadSchema( | ||
` | ||
model User { | ||
id Int @id @default(autoincrement()) | ||
name String | ||
post Post? @relation(fields: [postId], references: [id]) | ||
postId Int? | ||
@@allow('all', true) | ||
} | ||
model Post { | ||
id Int @id @default(autoincrement()) | ||
title String | ||
User User[] | ||
@@allow('all', true) | ||
} | ||
` | ||
); | ||
|
||
const db = enhance(); | ||
|
||
const user = await prisma.user.create({ | ||
data: { name: 'Me' }, | ||
}); | ||
|
||
await db.user.update({ | ||
where: { id: user.id }, | ||
data: { | ||
post: { | ||
upsert: { | ||
create: { | ||
title: 'Hello World', | ||
}, | ||
update: { | ||
title: 'Hello World', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}); | ||
}); | ||
}); |