Skip to content

feat: GL-account filter for ledger export - #635

Merged
thlpkee20-wq merged 6 commits into
RevoraOrg:masterfrom
sunnykid-02:feat/ledger-export-gl-filter
Jul 29, 2026
Merged

feat: GL-account filter for ledger export#635
thlpkee20-wq merged 6 commits into
RevoraOrg:masterfrom
sunnykid-02:feat/ledger-export-gl-filter

Conversation

@sunnykid-02

Copy link
Copy Markdown
Contributor

Close: #482

Summary
Implemented GET /api/v1/ledger/export?gl_account=&cursor=&limit= with HMAC-signed opaque cursor pagination and computed totals row.
Files changed
File Action Purpose
src/lib/pagination.ts Modified Added signCursor() / verifyCursor() HMAC-SHA256 helpers
src/services/ledgerExportService.ts Created LedgerExportService.byGlAccount(), InMemoryLedgerRepository, types, computeTotals() with BigInt arithmetic
src/routes/ledgerExport.ts Created Route handler with input validation
src/routes/ledgerExport.test.ts Created 10 contract tests covering all edge cases
src/db/repositories/ledgerEntryRepository.ts Created PG-backed PgLedgerEntryRepository for production use
src/index.ts Modified Mounted /ledger/export at apiRouter level
src/config/env.ts Modified Added CURSOR_SIGNING_SECRET and WEBHOOK_QUEUE_MAX_DEPTH
docs/ledger-export-gl-filter.md Created Full documentation
Key design decisions

  • Cursor format: base64url(JSON({id,gl,t})) . base64url(HMAC-SHA256) — opaque, scoped to gl_account, tamper-proof
  • Totals row: computed using BigInt arithmetic on decimal strings — exact match to sum of returned entries
  • Repository interface: abstract LedgerExportRepository for DI — in-memory for tests, PgLedgerEntryRepository for production
  • hasMore: determined by fetching limit + 1 and discarding the extra; no offset-position query needed
    Test results
    Tests: 10 passed, 10 total
    Coverage on new files: ledgerExport.ts 95.45%, ledgerExportService.ts 100% lines.

@drips-wave

drips-wave Bot commented Jul 28, 2026

Copy link
Copy Markdown

@sunnykid-02 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

@sunnykid-02

Copy link
Copy Markdown
Contributor Author

Done. Close: #635

@thlpkee20-wq
thlpkee20-wq merged commit 4eaedc7 into RevoraOrg:master Jul 29, 2026
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.

Ledger-export endpoint filter by GL account with pagination cursor and totals row

3 participants