Skip to content

feat(api): add POST /transactions/status-batch endpoint#138

Open
Paranoa-dev wants to merge 1 commit into
Pidoko257:mainfrom
Paranoa-dev:feat/bulk-transaction-status-query
Open

feat(api): add POST /transactions/status-batch endpoint#138
Paranoa-dev wants to merge 1 commit into
Pidoko257:mainfrom
Paranoa-dev:feat/bulk-transaction-status-query

Conversation

@Paranoa-dev

Copy link
Copy Markdown

Bulk Transaction Status Query API

Summary

Adds a POST /api/v1/transactions/status-batch endpoint that accepts up to 100 transaction IDs and returns their statuses in a single response, using a single SQL WHERE id = ANY(...) query for optimal performance.

Acceptance Criteria

  • ✅ Endpoint accepts an array of up to 100 transaction IDs in the request body
  • ✅ Single SQL query fetches all requested transactions using WHERE id = ANY(...)
  • ✅ Response is a map of { transactionId: status } for quick lookup
  • ✅ Transaction IDs not belonging to the requesting org return null in the map (not an error)

Implementation

Model (src/models/transaction.ts)

  • Added findByIds(ids, userId?) — single query with WHERE id = ANY($1), scoped to userId when provided, returns { id, status }[]

Controller (src/controllers/transactionController.ts)

  • Added statusBatchHandler — validates request body with Zod (array(uuid).min(1).max(100)), queries via model, builds { [id]: status | null } response map
  • IDs not found or not owned by the requesting user return null (not an error)

Route (src/routes/v1/transactions.ts)

  • POST /status-batch — requires auth, quick timeout, v1 API version

OpenAPI

  • Registered StatusBatchRequest and StatusBatchResponse schemas
  • Registered the POST /api/v1/transactions/status-batch path with full documentation

closes #112

- 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
@drips-wave

drips-wave Bot commented Jun 30, 2026

Copy link
Copy Markdown

@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! 🚀

Learn more about application limits

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.

Implement Bulk Transaction Status Query API

1 participant