Add property valuation query handler with AVM (Automated Valuation Model) service integration. Improve market index, heatmap, and price trend handlers with proper dependency injection and error handling. Co-Authored-By: Paperclip <noreply@paperclip.ing>
40 lines
883 B
TypeScript
40 lines
883 B
TypeScript
import { type PropertyType } from '@prisma/client';
|
|
|
|
export const AVM_SERVICE = Symbol('AVM_SERVICE');
|
|
|
|
export interface AVMParams {
|
|
propertyId?: string;
|
|
latitude?: number;
|
|
longitude?: number;
|
|
areaM2?: number;
|
|
propertyType?: PropertyType;
|
|
yearBuilt?: number;
|
|
floor?: number;
|
|
totalFloors?: number;
|
|
}
|
|
|
|
export interface Comparable {
|
|
propertyId: string;
|
|
address: string;
|
|
district: string;
|
|
priceVND: string;
|
|
pricePerM2: number;
|
|
areaM2: number;
|
|
propertyType: PropertyType;
|
|
distanceMeters: number;
|
|
soldAt: string;
|
|
}
|
|
|
|
export interface ValuationResult {
|
|
estimatedPrice: string;
|
|
confidence: number;
|
|
pricePerM2: number;
|
|
comparables: Comparable[];
|
|
modelVersion: string;
|
|
}
|
|
|
|
export interface IAVMService {
|
|
estimateValue(params: AVMParams): Promise<ValuationResult>;
|
|
getComparables(propertyId: string, radiusMeters: number): Promise<Comparable[]>;
|
|
}
|