Feature/api backlog batch - #682
Merged
Mimah97 merged 4 commits intoJul 27, 2026
Merged
Conversation
Add CANDLES_QUEUE_NAME alongside the existing QUEUE_NAMES map in indexer/queues.ts so the candle-aggregation queue name lives in the same module as the indexer's queue names instead of as a standalone string literal in candles.processor.ts. Kept out of QUEUE_NAMES itself since IndexerWorker iterates Object.values(QUEUE_NAMES) to attach its DLQ QueueEvents listeners, and the candle queue has its own listeners.
Bound CandlesWorker.onModuleDestroy with a timeout (mirroring IndexerWorker's SHUTDOWN_TIMEOUT_MS pattern) so a stuck candle job can't hang the process past a deploy platform's kill grace period, log the drain start/end, expose isShuttingDown, and guard against closing an unset worker if SIGTERM arrives before onModuleInit finishes. Each priceCandle write is already a single upsert of the fully-computed OHLCV row, so there's no partial/incremental write to corrupt if a job is interrupted between pools — documented in candles.processor.ts and in a new "Graceful Shutdown" section of docs/OPS_DEPLOYMENT.md, alongside a test suite covering the drain, timeout, and pre-init-shutdown paths.
mockToken/mockPool/mockSwap in mock-factories.ts didn't match the actual
Prisma schema (e.g. mockPool used address/token0Id/tvlUsd — fields that
don't exist on the real Pool model) and were unused anywhere, so they
silently drifted. Fix them to mirror prisma/schema.prisma, drop the
unused mockOhlcv (no Ohlcv model exists), and add mockPoolDetailData(),
a composite factory for the { pool, token0, token1 } shape
PoolsRepository.getPoolDetailById() returns.
Refactor pools.service.spec.ts's getPoolTicks() and findPoolById() suites
to build fixtures from these factories instead of three near-duplicate
20-line inline object literals.
There was no swap-quote endpoint in the API at all — quote math only existed client-side in packages/sdk/src/quote.ts, using a placeholder constant-product formula with hardcoded reserves. Add a real endpoint that estimates a quote from the pool's actual current spot price (decoded from currentSqrtPrice) and feeTier, going through PoolsService so it reuses the existing pool lookup path. SwapQuoteRequestDto/SwapQuoteResponseDto carry realistic @ApiProperty examples, and the controller's @ApiBody adds a full request example — both verified to appear in the generated OpenAPI JSON by a new swaps.swagger.spec.ts test that builds the document via SwaggerModule.createDocument() and asserts on it directly. Also fixes swaps.e2e.spec.ts's `import * as request from 'supertest'` to the default import used everywhere else in the codebase — the namespace import made every test in the file throw "request is not a function", which was silently swallowing failures (including two pre-existing, unrelated test bugs the fix now surfaces: a poolId/pool query-param mismatch and a non-Stellar-format wallet address in two GET /swaps tests — left alone as out of scope here).
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
Related issue
Type of change
Checklist