Skip to content

feat(routes): mount forecast router on API index (#1215) - #1482

Closed
lienhoatienphung-svg wants to merge 1 commit into
CalloraOrg:mainfrom
lienhoatienphung-svg:feat/1215-mount-forecast-router
Closed

lienhoatienphung-svg wants to merge 1 commit into
CalloraOrg:mainfrom
lienhoatienphung-svg:feat/1215-mount-forecast-router

Conversation

@lienhoatienphung-svg

Copy link
Copy Markdown

Summary

Mounts the imported forecast routers in src/routes/index.ts at /api/forecast and /api/billing/forecast with consistent authentication and response shapes, and documents the canonical endpoint and alias in docs/billing-forecast-endpoint.md.

Closes #1215

Key Changes

  1. Router Mounting (src/routes/index.ts):
    • Mounted createForecastRouter() at /forecast (GET /api/forecast) and createBillingForecastRouter() at /billing/forecast (GET /api/billing/forecast).
  2. Authentication & Response Parity (src/routes/forecast.ts, src/routes/billing/forecast.ts):
    • Added requireAuth fallback support on GET /api/forecast when no upstream proxy injected req.user while preserving direct req.user test injection.
    • Exported createBillingForecastRouter and aligned docs/billing-forecast-endpoint.md with the mounted routes.
  3. Integration Tests (src/routes/forecast.test.ts):
    • Added integration tests against createApp() verifying 401 when unauthenticated and 200 with projected spend on both /api/forecast and /api/billing/forecast.

Verification

  • Verified with npx jest src/routes/forecast.test.ts (36/36 passed).

Payout Wallet (Base Mainnet USDC)

0x3806cd592a508d1992Ed007C2F53de251C2E7452

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.

Mount the forecast router imported by API index

2 participants