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

@@ -0,0 +1,14 @@
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { PropertyType } from '@prisma/client';
import { IsEnum, IsOptional, IsString } from 'class-validator';
export class GetMarketSnapshotDto {
@ApiProperty({ description: 'City name', example: 'HCMC' })
@IsString()
city!: string;
@ApiPropertyOptional({ enum: PropertyType, description: 'Property type filter' })
@IsOptional()
@IsEnum(PropertyType)
propertyType?: PropertyType;
}