-
Notifications
You must be signed in to change notification settings - Fork 18
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
feat: ajusts quary to make it the same as allProjects query #1754
Conversation
WalkthroughThe recent change refines the query logic in the Changes
Poem
Recent review detailsConfiguration used: CodeRabbit UI Files selected for processing (1)
Additional comments not posted (2)
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 as PR comments)
Additionally, you can add 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.
LGTM ;), thc @Reshzera
@@ -437,7 +437,10 @@ export const totalProjectsPerDate = async ( | |||
} | |||
|
|||
if (onlyListed) { | |||
query.andWhere(`project."reviewStatus" = 'Listed'`); | |||
query.andWhere( | |||
`project.statusId = ${ProjStatus.active} AND project.reviewStatus = :reviewStatus`, |
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.
I think it's not a good idea to add statusId
condition inside onlyListed
condition, because those are separate conditions
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.
@RamRamez he can move it outside, but what if this statusId is only related to listed projects? I just asking, want to know :)
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.
@kkatusic I checked and we have some listed projects with status other than active
, so we should check them separately. I asked Mitch in the issue for clarification.
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.
thx
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.
@RamRamez I just fixed the error could you please take a look again
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: 0
Outside diff range, codebase verification and nitpick comments (1)
src/repositories/projectRepository.ts (1)
427-428
: Use Parameterized Queries forstatusId
The current implementation uses a non-parameterized query for
statusId
, which could lead to security vulnerabilities. It is recommended to use parameterized queries to prevent potential SQL injection attacks.
- Consider changing
project.statusId = ${ProjStatus.active}
to a parameterized query format.Analysis chain
Verify the placement of the
statusId
condition.The addition of the
statusId
condition aligns with the PR objectives. However, ensure that this condition is correctly placed in the query logic, as there were concerns about its placement in previous reviews.Run the following script to verify the placement of the
statusId
condition:Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the placement of the `statusId` condition in the query logic. # Test: Search for the usage of `statusId` in the codebase. Expect: Correct placement in query logic. rg --type typescript -A 5 $'statusId'Length of output: 71
Script:
#!/bin/bash # Description: Verify the placement of the `statusId` condition in the query logic. # Test: Search for the usage of `statusId` in the codebase. Expect: Correct placement in query logic. rg --type ts -A 5 $'statusId'Length of output: 81383
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.
Thanks @Reshzera
Summary by CodeRabbit