-
-
Notifications
You must be signed in to change notification settings - Fork 12
fix: issues and tests about self relations #189
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
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
Status, Documentation and Community
|
|
Claude finished @ymc9's task —— View job PR Review: Self Relations Implementation
|
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.
Pull Request Overview
This PR fixes issues related to self-relations by updating computed field signatures and improving SQL generation for self-referencing scenarios. The changes ensure proper handling of table aliases and field references in complex query scenarios involving self-relations.
- Adds a
contextparameter withcurrentModelto computed field implementations for dynamic table references - Improves many-to-many self-relation handling with proper foreign key ordering based on field names
- Restructures relation tests into separate files for better organization
Reviewed Changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/sdk/src/ts-schema-generator.ts | Updates computed field method signature to include context parameter |
| samples/blog/zenstack/schema.ts | Updates postCount computed field signature to match new interface |
| samples/blog/main.ts | Updates computed field implementation to use dynamic table references |
| packages/runtime/src/client/query-utils.ts | Modifies buildFieldRef to pass currentModel context to computed fields |
| packages/runtime/src/client/crud/dialects/*.ts | Updates query building methods to handle model aliases for self-relations |
| packages/runtime/test/client-api/relation/*.test.ts | Reorganizes relation tests and adds comprehensive self-relation test coverage |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

No description provided.