Skip to content

fix(router): timeentry/export.csv must come before /:id#69

Merged
CryptoJones merged 1 commit into
masterfrom
fix/timeentry-export-csv-route-order
May 18, 2026
Merged

fix(router): timeentry/export.csv must come before /:id#69
CryptoJones merged 1 commit into
masterfrom
fix/timeentry-export-csv-route-order

Conversation

@CryptoJones
Copy link
Copy Markdown
Owner

Hot follow-up to #68. The new /v1/timeentry/export.csv route was placed AFTER the existing /v1/timeentry/:id block, so express matched :id-with-"export.csv" first, intIdParam failed coercion to a number, and the export handler was never reached. The 403-on-missing-authKey test was failing as a result.

Reorders so the literal path wins, matching the search-before-:id convention already used for /v1/customer/search (#64).

Proudly Made in Nebraska. Go Big Red! 🌽 https://xkcd.com/2347/

#68 added /v1/timeentry/export.csv but placed the route AFTER the
existing /v1/timeentry/:id block. Express tries patterns top-down,
so a GET to /v1/timeentry/export.csv matched the :id route first,
the intIdParam validator parsed "export.csv" → NaN → 400 with
"expected number". The test that asserts 403 on missing authKey
was flaking on this path. The export handler was never reached.

Mirrors the search-before-:id ordering #64 used for customer.
Added a comment block flagging the rule for future contributors.

All four timeentry CRUD routes still resolve correctly — they
sit AFTER the literals now, which is the correct order.

Suite: 261 / 261 + 4 integration skipped (post-fix).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@CryptoJones CryptoJones merged commit 9202f35 into master May 18, 2026
1 check was pending
@CryptoJones CryptoJones deleted the fix/timeentry-export-csv-route-order branch May 18, 2026 02:14
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.

1 participant