-
Notifications
You must be signed in to change notification settings - Fork 22
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
just hotfixing the validation message #3728
Conversation
📝 WalkthroughWalkthroughThe changes in the Changes
Possibly related PRs
Suggested reviewers
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 (
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## staging #3728 +/- ##
========================================
Coverage 11.69% 11.69%
========================================
Files 110 110
Lines 14847 14847
Branches 274 274
========================================
Hits 1737 1737
Misses 13110 13110 |
Auth-service changes in this PR available for preview here |
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 and nitpick comments (1)
src/auth-service/middleware/validateSelectedSites.js (1)
55-57
: Validation logic looks good with a minor suggestion.The site_id validation logic is well-implemented and the error message is clear. However, for consistency with other validation messages in the file, consider adding quotes around the field name in the error message.
- siteErrors.push("site_id must be a valid MongoDB ObjectId"); + siteErrors.push("'site_id' must be a valid MongoDB ObjectId");
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
- src/auth-service/middleware/validateSelectedSites.js (1 hunks)
🧰 Additional context used
📓 Learnings (1)
src/auth-service/middleware/validateSelectedSites.js (1)
Learnt from: Baalmart PR: airqo-platform/AirQo-api#3699 File: src/auth-service/middleware/validateSelectedSites.js:7-8 Timestamp: 2024-10-20T13:41:41.354Z Learning: In the `validateSelectedSites` middleware, inputs may be provided not only via `selected_sites` but also directly in `req.body`, so the code handles both cases appropriately.
🔇 Additional comments (1)
src/auth-service/middleware/validateSelectedSites.js (1)
Line range hint
5-5
: Consider preserving the default value for backward compatibility.The removal of the default value
allowId = false
could be a breaking change for existing callers that rely on this parameter being optional. Since this PR's objective is to hotfix the validation message, we should minimize the risk of unintended side effects.Suggested fix:
- const validateSelectedSites = (requiredFields, allowId = false) => { + const validateSelectedSites = (requiredFields, allowId = false) => {Let's verify the usage of this middleware to assess the impact:
Description
just hotfixing the validation message
Changes Made
Testing
Affected Services
Endpoints Ready for Testing
API Documentation Updated?
Additional Notes
just hotfixing the validation message
Summary by CodeRabbit
New Features
site_id
whenallowId
is false.Bug Fixes
Documentation
site_id
.