feat(transactions): implement sync, categorization, and history in TransactionsService - #116
Merged
Uyoxy merged 2 commits intoAug 24, 2026
Merged
Conversation
…regation - syncTransactions: fetch last 200 Horizon ops, normalize payments, insert with ON CONFLICT (hash) DO NOTHING, return new-row count - getHistory: paginated query with optional category/asset filters - categorize: updates category, enforces userId ownership (403/404) - getSpendingByCategory: aggregated totals grouped by category - Fix Horizon SDK import to use @stellar/stellar-sdk Horizon.Server, matching BlockchainService - Add unit tests covering dedup, pagination, ownership checks, aggregation Refs stellarspend#108
Contributor
|
Nice work — this fully closes out #108. Went through each acceptance
|
…regation - syncTransactions: fetch last 200 Horizon ops, normalize payments, insert with ON CONFLICT (hash) DO NOTHING, return new-row count - getHistory: paginated query with optional category/asset filters - categorize: updates category, enforces userId ownership (403/404) - getSpendingByCategory: aggregated totals grouped by category - Fix Horizon SDK import to use @stellar/stellar-sdk Horizon.Server, matching BlockchainService - Add unit tests covering dedup, pagination, ownership checks, aggregation Refs stellarspend#108
Contributor
|
great |
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.
Changes
syncTransactions(userId, publicKey): fetches the last 200 Horizon operations, filters to payment-type ops, normalizes intoTransactionEntityrows, inserts viaON CONFLICT (hash) DO NOTHING, returns the count of rows actually inserted (viaRETURNING, so duplicates aren't counted)getHistory(userId, options): paginated query with optionalcategory/assetfilters, ordered newest-firstcategorize(userId, transactionId, category): updates category on a single row; throwsNotFoundExceptionif missing,ForbiddenExceptionif it belongs to another usergetSpendingByCategory(userId, asset, since): aggregated totals per categorytransactions.service.spec.tscovering sync deduplication (including repeat-call idempotency), pagination, category ownership checks, and aggregationNot included in this PR
TransactionsControllerwiring withJwtAuthGuardtransactions.module.tsTypeORM wiringadd-transactions-indexes.ts)These remain open scope items from #108 — this PR covers the service layer only. Will follow up separately / update if handling the rest in this same branch.
Testing
npm run build— clean, no errorsnpm test -- transactions—closes Implement transaction sync, categorization, and history in TransactionsService #108