feat: cursor pagination, standardized error DTO, and Zod hardening #681
Merged
Mimah97 merged 3 commits intoJun 30, 2026
Merged
Conversation
…atix-Protocol#562, Vatix-Protocol#564, Vatix-Protocol#563) - Vatix-Protocol#562: Fix stale offset-pagination tests for GET /orders/user/:address; align assertions with cursor-pagination impl (nextCursor, hasNext, take:limit+1); add tests for nextCursor generation, invalid cursor (400), and cursor-based next page - Vatix-Protocol#564: Add `code` field to ErrorResponse DTO (VALIDATION_ERROR, NOT_FOUND, UNAUTHORIZED, FORBIDDEN, INTERNAL_ERROR, BAD_REQUEST); covered by new tests - Vatix-Protocol#563: Harden POST /orders Zod schema — userAddress now validated against STELLAR_PUBLIC_KEY_REGEX before any DB call; add zod to dependencies Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
GET /orders/user/:address— fixed stale offset-pagination tests (skip,total,page) that were mismatched with the existing cursor-based implementation; updated assertions to usenextCursor,hasNext,take: limit+1; added tests fornextCursorgeneration, invalid cursor (400), and cursor-driven next-page fetchcodefield toErrorResponse(VALIDATION_ERROR,NOT_FOUND,UNAUTHORIZED,FORBIDDEN,INTERNAL_ERROR,BAD_REQUEST);resolveCode()helper inerrorHandler.ts; covered by new testsz.string().min(1)onuserAddresswithSTELLAR_PUBLIC_KEY_REGEXso malformed Stellar keys are caught at the Zod layer before any DB call; addedzodto dependenciesTest plan
GET /orders/user/:address— response shape:nextCursor,hasNext,limit; nototalorpageGET /orders/user/:address?limit=2with 3 DB rows →hasNext: true,nextCursoris a string,orders.length === 2GET /orders/user/:address?cursor=<invalid>→ 400GET /orders/user/:address?cursor=<valid base64url>→ 200, applies cursor WHERE clauseGET /orders/user/:address?status=OPEN→findManycalled withtake: 21, noskipPOST /orderswith non-StellaruserAddress→ 400 from Zod before any DB call{ error, code, requestId, statusCode }with correctcodeper error classcloses #563
closes #564
closes #562