closing #485#493
Closed
aabxtract wants to merge 1 commit into
Closed
Conversation
Extend GET /api/v1/finance/transactions to support sortBy (date, status, type) and order (asc, desc) query params on top of the existing status/type/asset filters. Sorting is built dynamically from the validated params so the frontend can natively filter and order the transaction table. - Add sortBy/order to ListTransactionsSchema (validated, defaulted) - Replace hardcoded date-desc sort with dynamic comparator - Document new params in Swagger - Add route tests covering filtering, sorting and validation Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
@aabxtract is attempting to deploy a commit to the vestroll's projects Team on Vercel. A member of the Team first needs to authorize it. |
codeZe-us
reviewed
May 30, 2026
Contributor
codeZe-us
left a comment
There was a problem hiding this comment.
@aabxtract PR should point to dev branch not main branch
Author
|
which branch? |
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.
Approach
The transaction history endpoint (
GET /api/v1/finance/transactions) already filtered bystatus,type, andasset, but sorting was hardcoded to date-descending. I extended the validated query schema with two new params —sortBy(date | status | type) andorder(asc | desc) — and replaced the fixed sort with a dynamic comparator driven by those params. Filters and sort are composed from the presence and value of the validated query params, so the frontend can natively filter out failed transactions or view a specific type in any order without client-side post-processing.What changed
src/server/validations/finance.schema.ts— addedsortBy(enumdate|status|type, defaultdate) andorder(enumasc|desc, defaultdesc) toListTransactionsSchema. Invalid values are rejected with a 400.src/server/services/transaction.service.ts— replaced the hardcodedtimestamp descsort with a dynamic comparator:datesorts by timestamp,status/typesort alphabetically, andorderflips the direction.src/app/api/v1/finance/transactions/route.ts— readsortByandorderfrom the query string and documented both params in the Swagger block.src/app/api/v1/finance/transactions/route.test.ts— new tests covering default sort, status/type filtering, combined filters, ascending/descending sorts by each field, and 400s on invalidsortBy/order.Example
Testing
vitest run src/app/api/v1/finance/transactions/route.test.ts→ 9 passedvitest run src/app/api/v1/finance/→ 17 passed (no regressions)eslinton all changed files → cleanNotes
sortBy/ordersupplied, behavior is unchanged (date descending).devbranch, but nodevbranch currently exists onorigin(onlymain). Please confirm the target branch / createdevif needed.Closes #485