-
-
Notifications
You must be signed in to change notification settings - Fork 127
fix(openapi): bugfix for compound id create and update #1855
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ymc9
merged 6 commits into
zenstackhq:dev
from
thomassnielsen:bugfix/compound-id-create
Nov 26, 2024
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
510572d
Remove unnecessary id from create test
thomassnielsen 057c73b
Change openapi create openapi to match server
thomassnielsen 00990d8
Add test for updating compound id
thomassnielsen 040d1bd
Fix update of single relationship
thomassnielsen 4d95306
Expose compound id as separate fields always
thomassnielsen de8aefa
Simplify id fields @default check
thomassnielsen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -1742,7 +1742,6 @@ describe('REST server tests', () => { | |
| requestBody: { | ||
| data: { | ||
| type: 'postLike', | ||
| id: `1${idDivider}user1`, | ||
| attributes: { userId: 'user1', postId: 1, superLike: false }, | ||
| }, | ||
| }, | ||
|
|
@@ -2007,6 +2006,31 @@ describe('REST server tests', () => { | |
| expect(r.status).toBe(200); | ||
| }); | ||
|
|
||
| it('update the id of an item with compound id', async () => { | ||
| await prisma.user.create({ data: { myId: 'user1', email: '[email protected]' } }); | ||
| await prisma.post.create({ data: { id: 1, title: 'Post1' } }); | ||
| await prisma.post.create({ data: { id: 2, title: 'Post2' } }); | ||
| await prisma.postLike.create({ data: { userId: 'user1', postId: 1, superLike: false } }); | ||
|
|
||
| const r = await handler({ | ||
| method: 'put', | ||
| path: `/postLike/1${idDivider}user1`, | ||
| query: {}, | ||
| requestBody: { | ||
| data: { | ||
| type: 'postLike', | ||
| relationships: { | ||
| post: { data: { type: 'post', id: 2 } }, | ||
| }, | ||
| }, | ||
| }, | ||
| prisma, | ||
| }); | ||
|
|
||
| expect(r.status).toBe(200); | ||
| expect(r.body.data.id).toBe(`2${idDivider}user1`); | ||
| }); | ||
|
|
||
| it('update a single relation', async () => { | ||
| await prisma.user.create({ data: { myId: 'user1', email: '[email protected]' } }); | ||
| await prisma.post.create({ | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.