Repository navigation
feat(billing): back disputes router with Postgres repository (#1243) - #1480
Open
lienhoatienphung-svg wants to merge 1 commit into
Open
lienhoatienphung-svg wants to merge 1 commit into
lienhoatienphung-svg wants to merge 1 commit into
Conversation
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
Backs the billing disputes subsystem with a PostgreSQL repository (
PgDisputeRepository), mounts/api/billing/disputesinsrc/app.ts, and ensures dispute state and audit trails survive process restarts and work across replicas.Closes #1243
Key Changes
src/services/disputeService.ts):PgDisputeRepositoryagainstmigrations/0019_disputes.sql(disputesanddispute_eventstables), using transactionalBEGIN/COMMIT/ROLLBACKwrites when available.DisputeRepositoryinterface andDisputeServicewithMaybePromise<T>chaining so synchronousInMemoryDisputeRepositorycallers remain synchronous while asyncPgDisputeRepositorycallers returnPromises.src/routes/billing/disputes.ts,src/app.ts):/api/billing/disputesroute handlers toawaitDisputeServiceoperations./api/billing/disputesinsrc/app.tsbacked bynew PgDisputeRepository(pool)in non-test environments (falling back toInMemoryDisputeRepositoryin unit test mode when not overridden).migrations/0019_disputes.sql):resolution_notesondisputesandnotesondispute_eventsso the migration applies cleanly in both PostgreSQL (pg/pg-mem) and SQLite.Verification
pg-memintegration tests insrc/routes/billing/disputes.test.tscovering persistence across freshDisputeServiceinstances, audit trail creation/status updates, and409 Conflicton duplicate open disputes.npx jest src/routes/billing/disputes.test.ts(44/44 passed).Payout Wallet (Base Mainnet USDC)
0x3806cd592a508d1992Ed007C2F53de251C2E7452