feat(analytics): add GET /analytics/price-movers endpoint

Top tăng/giảm giá theo district cho Home dashboard.
Compares avg listing prices between current and previous time windows,
filters by min sample size (10), caches for 30 min.

TEC-3053

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Ho Ngoc Hai
2026-04-21 02:24:44 +07:00
parent a70db64da1
commit 0651074319
8 changed files with 337 additions and 0 deletions

View File

@@ -37,6 +37,8 @@ export const CacheTTL = {
MARKET_SNAPSHOT: 300, // 5 min
/** Trending areas — 30 min TTL, aggregation is expensive */
TRENDING_AREAS: 1800, // 30 min
/** Price movers — 30 min TTL, aggregation over two time windows */
PRICE_MOVERS: 1800, // 30 min
} as const;
export enum CachePrefix {
@@ -55,6 +57,7 @@ export enum CachePrefix {
AGENT_LISTINGS = 'cache:agent:listings',
MARKET_SNAPSHOT = 'cache:analytics:market_snapshot',
TRENDING_AREAS = 'cache:analytics:trending_areas',
PRICE_MOVERS = 'cache:analytics:price_movers',
}
@Injectable()