feat(search): add Idempotency-Key support on /api/search mutations - #699
Merged
greatest0fallt1me merged 1 commit intoJul 28, 2026
Merged
Conversation
|
@Ajibola6921 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Adds POST and PATCH mutation endpoints to /api/search with explicit idempotency-key middleware support for safe retries. Also mounts the search router in the app (it was imported but never used). POST /api/search — save a search query to history (idempotent) PATCH /api/search/:id — update a saved search label (idempotent) Closes Predictify-org#625
Ajibola6921
force-pushed
the
fix/idempotency-search-625
branch
from
July 28, 2026 13:20
1796218 to
dd7ba4e
Compare
Contributor
|
Merging — great job on the clean implementation. 💯 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR adds Idempotency-Key support for POST/PATCH mutations on the
/api/searchendpoint, enabling safe client-side retries without duplicate processing. It also mounts the previously-unused search router in the app.Related Issue
Closes #625
Changes
Idempotency-Key Middleware Integration
POST /api/searchendpoint with the existingidempotencymiddleware — saves a search query to the user's search history (returns 201)PATCH /api/search/:idendpoint with the existingidempotencymiddleware — updates a saved search label (returns 200)saveSearchBodySchema,updateSearchBodySchema) enforcing length limits, control character rejection, and required fieldssearchRouterat/api/searchinsrc/index.ts(it was imported but never wired to any path)Tests
tests/search.test.tswith 17 tests covering:Verification Results
idempotencymiddlewareidempotencymiddleware