fix(api): correct currency endpoint route from /currencies to /currency#1470
fix(api): correct currency endpoint route from /currencies to /currency#1470wucm667 wants to merge 2 commits into
Conversation
The route was registered as /api/v1/currencies (plural) but the documentation and swagger annotation specify /api/v1/currency (singular). This caused 404 errors when users called the documented endpoint. Fixes sysadminsmedia#1469
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughAdded a new endpoint Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Security RecommendationNo security issues spotted in the routing change. Verify that authentication/authorization middleware applied to the existing currency route also covers the new 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@backend/app/api/routes.go`:
- Line 83: Add a temporary compatibility alias for the currency endpoint by
registering a second GET route for "/currencies" that uses the same handler as
the existing "/currency" route (i.e., call
chain.ToHandlerFunc(v1Ctrl.HandleCurrency()) for the new route just like
r.Get("/currency", ...)). Keep this endpoint unauthenticated for now (same
middleware as existing route); if the handler (v1Ctrl.HandleCurrency) later
returns tenant- or user-specific data, protect the "/currencies" alias with
userMW in the same way as other authenticated routes.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 18996043-009c-44cf-9fc7-7329be2f2088
📒 Files selected for processing (1)
backend/app/api/routes.go
…oint Frontend code still calls /api/v1/currencies (see group.ts line 172). Adding this alias prevents regressions while the frontend migrates to the documented /api/v1/currency endpoint. Suggested-by: CodeRabbit review
|
The failing checks appear to be unrelated to this PR:
All backend Go tests pass, and the CodeRabbit review is complete. Thanks! |
Fixes #1469
Problem
The
/api/v1/currencyendpoint returns 404. The route was registered as/api/v1/currencies(plural) but the documentation and swagger annotation specify/api/v1/currency(singular).Root Cause
In
backend/app/api/routes.goline 83, the route was incorrectly registered:But the swagger annotation in
controller.gospecifies:// @Router /v1/currency [GET]Solution
Changed the route registration from
/currenciesto/currencyto match the documentation and swagger annotation.Changes
backend/app/api/routes.go: Line 83,/currencies→/currencySummary by CodeRabbit