feat(analytics): AVM v2 batch valuation, comparison, history + frontend upgrade

Add batch valuation (POST /analytics/valuation/batch, max 50 properties),
valuation comparison (POST /analytics/valuation/compare, 2-5 properties),
and history endpoint (GET /analytics/valuation/history/:propertyId) with
confidence explanation helper. Frontend: enhanced valuation form with project
autocomplete and deep analysis toggle, results with confidence badges and
price range visualization, comparables table, history chart, market context
card, and PDF export.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Ho Ngoc Hai
2026-04-16 05:08:05 +07:00
parent 93a390efb9
commit 8da488711b
27 changed files with 1715 additions and 162 deletions

View File

@@ -0,0 +1,17 @@
import { ApiProperty } from '@nestjs/swagger';
import { Transform } from 'class-transformer';
import { ArrayMaxSize, ArrayMinSize, IsArray, IsString } from 'class-validator';
export class BatchValuationDto {
@ApiProperty({
description: 'Array of property IDs to valuate (max 50)',
example: ['prop-1', 'prop-2'],
type: [String],
})
@IsArray()
@ArrayMinSize(1)
@ArrayMaxSize(50)
@IsString({ each: true })
@Transform(({ value }) => (Array.isArray(value) ? value : [value]))
propertyIds!: string[];
}

View File

@@ -3,3 +3,6 @@ export { GetHeatmapDto } from './get-heatmap.dto';
export { GetPriceTrendDto } from './get-price-trend.dto';
export { GetDistrictStatsDto } from './get-district-stats.dto';
export { GetValuationDto } from './get-valuation.dto';
export { BatchValuationDto } from './batch-valuation.dto';
export { ValuationHistoryDto } from './valuation-history.dto';
export { ValuationComparisonDto } from './valuation-comparison.dto';

View File

@@ -0,0 +1,17 @@
import { ApiProperty } from '@nestjs/swagger';
import { Transform } from 'class-transformer';
import { ArrayMaxSize, ArrayMinSize, IsArray, IsString } from 'class-validator';
export class ValuationComparisonDto {
@ApiProperty({
description: 'Array of property IDs to compare (2-5 properties)',
example: ['prop-1', 'prop-2', 'prop-3'],
type: [String],
})
@IsArray()
@ArrayMinSize(2)
@ArrayMaxSize(5)
@IsString({ each: true })
@Transform(({ value }) => (Array.isArray(value) ? value : [value]))
propertyIds!: string[];
}

View File

@@ -0,0 +1,13 @@
import { ApiPropertyOptional } from '@nestjs/swagger';
import { Transform } from 'class-transformer';
import { IsInt, IsOptional, Max, Min } from 'class-validator';
export class ValuationHistoryDto {
@ApiPropertyOptional({ description: 'Maximum number of history records (default: 50, max: 100)', default: 50 })
@IsOptional()
@IsInt()
@Min(1)
@Max(100)
@Transform(({ value }) => (value != null ? parseInt(value, 10) : 50))
limit?: number;
}