Skip to content

fix(api): correct currency endpoint route from /currencies to /currency#1470

Open
wucm667 wants to merge 2 commits into
sysadminsmedia:mainfrom
wucm667:fix/currency-endpoint-404
Open

fix(api): correct currency endpoint route from /currencies to /currency#1470
wucm667 wants to merge 2 commits into
sysadminsmedia:mainfrom
wucm667:fix/currency-endpoint-404

Conversation

@wucm667
Copy link
Copy Markdown

@wucm667 wucm667 commented Apr 28, 2026

Fixes #1469

Problem

The /api/v1/currency endpoint 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.go line 83, the route was incorrectly registered:

r.Get("/currencies", chain.ToHandlerFunc(v1Ctrl.HandleCurrency()))

But the swagger annotation in controller.go specifies:

// @Router    /v1/currency [GET]

Solution

Changed the route registration from /currencies to /currency to match the documentation and swagger annotation.

Changes

  • backend/app/api/routes.go: Line 83, /currencies/currency

Summary by CodeRabbit

  • API Changes
    • Added a singular currency endpoint for retrieving currency information.
    • Kept the existing plural endpoint as a temporary backward-compatible alias; it is deprecated and will be removed after frontend migration.

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
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 28, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: c704d92d-db74-4043-ac51-8fe4619a3929

📥 Commits

Reviewing files that changed from the base of the PR and between 87179e5 and 6ad196a.

📒 Files selected for processing (1)
  • backend/app/api/routes.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • backend/app/api/routes.go

Walkthrough

Added a new endpoint GET /api/v1/currency mapped to v1Ctrl.HandleCurrency() and kept GET /api/v1/currencies as a backward-compatible alias to the same handler (alias marked for future removal).

Changes

Cohort / File(s) Summary
Route registration
backend/app/api/routes.go
Register GET /api/v1/currency to v1Ctrl.HandleCurrency() and retain GET /api/v1/currencies as an alias (back-compat, slated for removal after frontend migration).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🔁 A route renewed, a twin kept near,
/currency arrives, /currencies stays clear.
Docs and code now sing in tune,
Small change, big fix — deploy by noon! ✨

Security Recommendation

No security issues spotted in the routing change. Verify that authentication/authorization middleware applied to the existing currency route also covers the new /api/v1/currency path and that any rate-limiting or input validation expectations remain intact.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Out of Scope Changes check ❓ Inconclusive All changes are scoped to fixing the currency endpoint route inconsistency. However, addition of backward-compatible /currencies alias extends beyond minimal scope. Clarify whether the /currencies alias is within scope or if it should be addressed in a separate PR to maintain focused, single-objective changes.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed Title accurately describes the main change: correcting the currency endpoint route from /currencies to /currency to match documentation.
Description check ✅ Passed Description includes problem statement, root cause analysis, and solution, but lacks explicit PR type classification and testing details as required by template.
Linked Issues check ✅ Passed Code changes directly address issue #1469 by correcting the route from /currencies to /currency, restoring documented endpoint functionality.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a 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

🤖 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

📥 Commits

Reviewing files that changed from the base of the PR and between 0e0c171 and 87179e5.

📒 Files selected for processing (1)
  • backend/app/api/routes.go

Comment thread 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
@wucm667
Copy link
Copy Markdown
Author

wucm667 commented Apr 28, 2026

The failing checks appear to be unrelated to this PR:

  1. Frontend Tests / Lint - This was already failing before this PR (see first CI run). This is a pre-existing issue in the repo.
  2. build (linux/arm64) - Infrastructure timeout: context deadline exceeded when pulling from ghcr.io. The amd64 build completed successfully.

All backend Go tests pass, and the CodeRabbit review is complete. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Base Currency Endpoint /v1/currency does not work, it returns 404

1 participant