feat: persist pools repository with Prisma and include poolId in pric…#457
Merged
Mimah97 merged 1 commit intoJun 30, 2026
Merged
Conversation
…e response - PoolsRepository now uses PrismaService instead of in-memory Map - Add migration to persist pool currentPrice and updatedAt columns - Price controller CandlesResponseDto now includes poolId - usePriceCandles hook parses string-based candle values from API - Fix web tests (QueryClientProvider wrapping, mutable mock state)
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.
PR #315 ## Persist Pools Repository with Prisma + Include
poolIdin Price ResponseWhat
Replaces the in-memory
Map-basedPoolsRepositorywith a Prisma-backed implementation so pool state (especiallycurrentPrice) survives API restarts. Also fixes the price controller response to includepoolIdfor frontend consumption.Changes
API — PoolsRepository (
apps/api/src/pools/pools.repository.ts)listActivePools,upsertPoolState,getTicksByPoolId,poolExists,getPoolDetailById) now query/update Prisma instead of an in-memory Map20260624000000_persist_pool_priceaddscurrentPriceandupdatedAtcolumns to thePooltableAPI — Price controller (
apps/api/src/price/price.controller.ts)GET /prices/:tokenA/:tokenB/:intervalnow returns{ poolId, candles }instead of{ candles }Web —
usePriceCandleshook (apps/web/hooks/usePriceCandles.ts)open,high,low,close,volume→Number(...))poolIdalongsidecandles,loading,currentPriceWeb — Tests
usePoolDetail.test.ts: Wraps hooks inQueryClientProviderto match current react-query requirementsSwapCard.test.tsx: Replaces brittlevi.mocked(require(...))with module-level mutable variables for cleaner state transitionsTesting
pools.repository.spec.ts— 4 tests, all passprice.controller.spec.ts— updated expectations, all passpools.service.spec.ts— 11 tests, all passNotes
pnpm-lock.yamlchange is a lockfile reformat from a newer pnpm version (no dependency changes)horizon.service.ts,positions.service.spec.ts) and are not addressed herepools.ticks.integration.spec.ts,all-exceptions.filter.spec.ts) require a running DB and are intentionally skipped in CI without oneCloses #315