-
-
Notifications
You must be signed in to change notification settings - Fork 110
fix(server): rest handler not returning correct id when model with compound id is read as a relation #1784
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
Conversation
…mpound id is read as a relation
📝 WalkthroughWalkthroughThe pull request introduces significant changes to the Changes
Possibly related PRs
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (1)
packages/server/tests/api/rest.test.ts (1)
1376-1409
: LGTM! Consider adding more assertions.The new test case "get as relationship" effectively verifies the API's handling of compound IDs when retrieving related data. It correctly sets up the test data, makes the appropriate request, and asserts the response structure.
Consider adding more specific assertions to verify the exact values of the included data, such as:
expect(r.body.included[0].attributes).toEqual({ postId: 1, userId: 'user2', superLike: false, });This would provide a more thorough check of the response content.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
- packages/server/src/api/rest/index.ts (3 hunks)
- packages/server/tests/api/rest.test.ts (1 hunks)
🧰 Additional context used
🔇 Additional comments (2)
packages/server/src/api/rest/index.ts (2)
8-8
: Approved the addition of necessary importsThe addition of
clone
,enumerate
,getIdFields
, andisPrismaClientKnownRequestError
to the imports is appropriate and necessary for the implemented functionality.
1124-1125
: Consider the performance impact of cloning large datasetsCloning the
items
object before injecting compound IDs ensures immutability, which is good practice. However, ifitems
can be large, cloning could introduce significant performance overhead. Please verify that this change does not adversely affect performance with large datasets.
No description provided.