feat(api): add POST /transactions/status-batch endpoint#138
Open
Paranoa-dev wants to merge 1 commit into
Open
Conversation
- Add TransactionModel.findByIds(ids, userId?) with single WHERE id = ANY() query
- Add statusBatchHandler accepting up to 100 UUIDs, returning { id: status | null }
- Register route POST /api/v1/transactions/status-batch with requireAuth
- Register OpenAPI StatusBatchRequest, StatusBatchResponse schemas and path
|
@Paranoa-dev 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! 🚀 |
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.
Bulk Transaction Status Query API
Summary
Adds a
POST /api/v1/transactions/status-batchendpoint that accepts up to 100 transaction IDs and returns their statuses in a single response, using a single SQLWHERE id = ANY(...)query for optimal performance.Acceptance Criteria
WHERE id = ANY(...){ transactionId: status }for quick lookupnullin the map (not an error)Implementation
Model (
src/models/transaction.ts)findByIds(ids, userId?)— single query withWHERE id = ANY($1), scoped touserIdwhen provided, returns{ id, status }[]Controller (
src/controllers/transactionController.ts)statusBatchHandler— validates request body with Zod (array(uuid).min(1).max(100)), queries via model, builds{ [id]: status | null }response mapnull(not an error)Route (
src/routes/v1/transactions.ts)POST /status-batch— requires auth, quick timeout, v1 API versionOpenAPI
StatusBatchRequestandStatusBatchResponseschemasPOST /api/v1/transactions/status-batchpath with full documentationcloses #112