📌 Description
LiquidityEntry carries an updatedAt timestamp, but the aggregated Pool interface ({ asset, total, anchors }, computed on-the-fly by LiquidityRepository.pools()) has no timestamp at all. A client reading GET /api/v1/liquidity or GET /api/v1/liquidity/:asset has no way to tell how recently any of the underlying entries changed without separately fetching /entries and computing a max updatedAt themselves.
🧩 Requirements and context
- Add an optional
lastUpdated?: string field to the Pool interface, computed as the max updatedAt across the asset's contributing LiquidityEntry records.
- Compute it in
LiquidityRepository.pools() alongside the existing total/anchors aggregation, with no extra full-table pass.
- Update
LiquidityService.listPools/getPool callers implicitly (no code change needed if they just pass the Pool through) and openapi.ts's documented response shape.
🛠️ Suggested execution
- Modify
src/repositories/liquidityRepository.ts's pools() method to track and set lastUpdated while iterating entries.
- Modify
src/models/liquidity.ts's Pool interface.
- Update
src/openapi.ts's /api/v1/liquidity and /api/v1/liquidity/{asset} response documentation.
- Add tests in
src/repositories/liquidityRepository.test.ts and src/services/liquidityService.test.ts asserting lastUpdated reflects the most recent contributing entry's updatedAt.
✅ Acceptance criteria
🔒 Security notes
N/A — read-only freshness metadata over already-exposed aggregate data.
📋 Guidelines
- Minimum 95% test coverage
- Clear documentation
- Timeframe: 96 hours
📌 Description
LiquidityEntrycarries anupdatedAttimestamp, but the aggregatedPoolinterface ({ asset, total, anchors }, computed on-the-fly byLiquidityRepository.pools()) has no timestamp at all. A client readingGET /api/v1/liquidityorGET /api/v1/liquidity/:assethas no way to tell how recently any of the underlying entries changed without separately fetching/entriesand computing a maxupdatedAtthemselves.🧩 Requirements and context
lastUpdated?: stringfield to thePoolinterface, computed as the maxupdatedAtacross the asset's contributingLiquidityEntryrecords.LiquidityRepository.pools()alongside the existingtotal/anchorsaggregation, with no extra full-table pass.LiquidityService.listPools/getPoolcallers implicitly (no code change needed if they just pass thePoolthrough) andopenapi.ts's documented response shape.🛠️ Suggested execution
src/repositories/liquidityRepository.ts'spools()method to track and setlastUpdatedwhile iterating entries.src/models/liquidity.ts'sPoolinterface.src/openapi.ts's/api/v1/liquidityand/api/v1/liquidity/{asset}response documentation.src/repositories/liquidityRepository.test.tsandsrc/services/liquidityService.test.tsassertinglastUpdatedreflects the most recent contributing entry'supdatedAt.✅ Acceptance criteria
Pool.lastUpdatedreflects the maximumupdatedAtamong the asset's entries.GET /api/v1/liquidityandGET /api/v1/liquidity/:assetinclude the new field.🔒 Security notes
N/A — read-only freshness metadata over already-exposed aggregate data.
📋 Guidelines