-
Notifications
You must be signed in to change notification settings - Fork 2
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
get all relations #92
Conversation
WalkthroughThe changes involve updates to the Changes
Poem
🪧 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)
src/helpers/Query.ts (1)
497-502
: Good addition of soft delete handlingThe inclusion of soft delete handling is a positive change. It ensures that soft-deleted records are excluded from relation queries when this feature is enabled in the database configuration.
However, the indentation of this block is inconsistent with the rest of the method. Please adjust the indentation to match the surrounding code for better readability.
limit: 9999, | ||
offset: 0, |
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.
Reconsider default values for limit
and offset
Setting default values for limit
and offset
might have unintended consequences:
- The high limit (9999) could potentially lead to performance issues with large datasets.
- It overrides any limit set in the
relation
object, which might not be the intended behavior.
Consider one of the following approaches:
- Remove these default values and let the underlying database method handle defaults.
- Use more conservative default values (e.g., limit: 100).
- Only set these defaults if they're not already specified in the
relation
object.
Here's a possible implementation for the third approach:
const relationOptions = <DatabaseFindManyOptions>{
schema: relation.schema,
fields: relation.columns,
where: where,
- limit: 9999,
- offset: 0,
+ limit: relation.limit ?? 100, // Use a more conservative default
+ offset: relation.offset ?? 0,
}
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
limit: 9999, | |
offset: 0, | |
limit: relation.limit ?? 100, // Use a more conservative default | |
offset: relation.offset ?? 0, |
Summary by CodeRabbit
New Features
Bug Fixes