feat(analytics): add GET /analytics/market-snapshot endpoint

Dashboard tile endpoint returning activeCount, avgPrice, medianPrice,
priceChangePct (1d/7d/30d), avgPricePerM2, daysOnMarket, newListings24h.
Redis cache-aside with 5min TTL. CQRS query handler with parallel
Prisma queries for p95 <200ms on cache hit.

Refs: TEC-3049

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Ho Ngoc Hai
2026-04-21 02:06:57 +07:00
parent d91e3f6fe2
commit bcd8b6685a
7 changed files with 366 additions and 0 deletions

View File

@@ -13,6 +13,7 @@ import { GetDistrictStatsHandler } from './application/queries/get-district-stat
import { GetHeatmapHandler } from './application/queries/get-heatmap/get-heatmap.handler';
import { GetListingAiAdviceHandler } from './application/queries/get-listing-ai-advice/get-listing-ai-advice.handler';
import { GetMarketReportHandler } from './application/queries/get-market-report/get-market-report.handler';
import { GetMarketSnapshotHandler } from './application/queries/get-market-snapshot/get-market-snapshot.handler';
import { GetProjectAiAdviceHandler } from './application/queries/get-project-ai-advice/get-project-ai-advice.handler';
import { GetNearbyPOIsHandler } from './application/queries/get-nearby-pois/get-nearby-pois.handler';
import { GetNeighborhoodScoreHandler } from './application/queries/get-neighborhood-score/get-neighborhood-score.handler';
@@ -61,6 +62,7 @@ const QueryHandlers = [
IndustrialValuationHandler,
GetListingAiAdviceHandler,
GetProjectAiAdviceHandler,
GetMarketSnapshotHandler,
];
const EventHandlers = [