Files
goodgo-platform/apps/web/lib/validations/valuation.ts
Ho Ngoc Hai 8da488711b 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>
2026-04-16 05:08:05 +07:00

40 lines
1.4 KiB
TypeScript

import { z } from 'zod';
export const VALUATION_PROPERTY_TYPES = [
{ value: 'APARTMENT', label: 'Căn hộ' },
{ value: 'HOUSE', label: 'Nhà riêng' },
{ value: 'VILLA', label: 'Biệt thự' },
{ value: 'LAND', label: 'Đất nền' },
{ value: 'OFFICE', label: 'Văn phòng' },
{ value: 'SHOPHOUSE', label: 'Shophouse' },
] as const;
export const CITIES = [
{ value: 'Ho Chi Minh', label: 'TP. Hồ Chí Minh' },
{ value: 'Ha Noi', label: 'Hà Nội' },
{ value: 'Da Nang', label: 'Đà Nẵng' },
] as const;
export const valuationFormSchema = z.object({
propertyType: z.string().min(1, 'Vui lòng chọn loại bất động sản'),
area: z.string().min(1, 'Vui lòng nhập diện tích').refine(
(val) => !isNaN(Number(val)) && Number(val) > 0,
'Diện tích phải lớn hơn 0',
),
district: z.string().min(1, 'Vui lòng nhập quận/huyện'),
city: z.string().min(1, 'Vui lòng chọn tỉnh/thành phố'),
bedrooms: z.string().optional(),
bathrooms: z.string().optional(),
floors: z.string().optional(),
frontage: z.string().optional(),
roadWidth: z.string().optional(),
yearBuilt: z.string().optional(),
hasLegalPaper: z.boolean().optional(),
/** New fields for enhanced form */
projectId: z.string().optional(),
description: z.string().optional(),
deepAnalysis: z.boolean().optional(),
});
export type ValuationFormData = z.infer<typeof valuationFormSchema>;