feat(api): add industrial, transfer, and reports backend modules
Add three new NestJS modules following DDD/CQRS architecture: - Industrial: KCN (industrial park) management with PostGIS geo queries, Typesense search, and market statistics - Transfer: Furniture/premises transfer listings with AI-powered price estimation and depreciation modeling - Reports: Async AI report generation via BullMQ with Claude narrative service, PDF generation, and macro data integration Includes Prisma schema models, migrations, seed scripts, and app.module wiring with BullMQ Redis config. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { ArrayMaxSize, ArrayMinSize, IsArray, IsString } from 'class-validator';
|
||||
|
||||
export class CompareIndustrialParksDto {
|
||||
@ApiProperty({
|
||||
example: ['seed-kcn-001', 'seed-kcn-003', 'seed-kcn-005'],
|
||||
description: 'Danh sách ID KCN so sánh (2-5)',
|
||||
})
|
||||
@IsArray()
|
||||
@IsString({ each: true })
|
||||
@ArrayMinSize(2)
|
||||
@ArrayMaxSize(5)
|
||||
ids!: string[];
|
||||
}
|
||||
@@ -0,0 +1,166 @@
|
||||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||
import { IndustrialParkStatus, VietnamRegion } from '@prisma/client';
|
||||
import { Type } from 'class-transformer';
|
||||
import {
|
||||
IsString,
|
||||
IsNumber,
|
||||
IsEnum,
|
||||
IsOptional,
|
||||
IsArray,
|
||||
IsObject,
|
||||
Min,
|
||||
Max,
|
||||
MaxLength,
|
||||
} from 'class-validator';
|
||||
|
||||
export class CreateIndustrialParkDto {
|
||||
@ApiProperty({ example: 'KCN VSIP Hải Phòng', description: 'Tên KCN' })
|
||||
@IsString()
|
||||
@MaxLength(200)
|
||||
name!: string;
|
||||
|
||||
@ApiPropertyOptional({ example: 'VSIP Hai Phong Industrial Park' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
nameEn?: string;
|
||||
|
||||
@ApiProperty({ example: 'vsip-hai-phong', description: 'URL slug (unique)' })
|
||||
@IsString()
|
||||
@MaxLength(100)
|
||||
slug!: string;
|
||||
|
||||
@ApiProperty({ example: 'VSIP Group' })
|
||||
@IsString()
|
||||
developer!: string;
|
||||
|
||||
@ApiPropertyOptional({ example: 'VSIP Joint Venture' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
operator?: string;
|
||||
|
||||
@ApiProperty({ enum: IndustrialParkStatus, example: 'OPERATIONAL' })
|
||||
@IsEnum(IndustrialParkStatus)
|
||||
status!: IndustrialParkStatus;
|
||||
|
||||
@ApiProperty({ example: 20.8312, description: 'Latitude' })
|
||||
@IsNumber()
|
||||
@Type(() => Number)
|
||||
@Min(-90)
|
||||
@Max(90)
|
||||
latitude!: number;
|
||||
|
||||
@ApiProperty({ example: 106.7198, description: 'Longitude' })
|
||||
@IsNumber()
|
||||
@Type(() => Number)
|
||||
@Min(-180)
|
||||
@Max(180)
|
||||
longitude!: number;
|
||||
|
||||
@ApiProperty({ example: 'Phường Đông Hải, Quận Hải An' })
|
||||
@IsString()
|
||||
address!: string;
|
||||
|
||||
@ApiProperty({ example: 'Hải An' })
|
||||
@IsString()
|
||||
district!: string;
|
||||
|
||||
@ApiProperty({ example: 'Hải Phòng' })
|
||||
@IsString()
|
||||
province!: string;
|
||||
|
||||
@ApiProperty({ enum: VietnamRegion, example: 'NORTH' })
|
||||
@IsEnum(VietnamRegion)
|
||||
region!: VietnamRegion;
|
||||
|
||||
@ApiProperty({ example: 1200, description: 'Tổng diện tích (ha)' })
|
||||
@IsNumber()
|
||||
@Type(() => Number)
|
||||
@Min(0)
|
||||
totalAreaHa!: number;
|
||||
|
||||
@ApiProperty({ example: 900, description: 'Diện tích cho thuê (ha)' })
|
||||
@IsNumber()
|
||||
@Type(() => Number)
|
||||
@Min(0)
|
||||
leasableAreaHa!: number;
|
||||
|
||||
@ApiProperty({ example: 75, description: 'Tỷ lệ lấp đầy (0-100)' })
|
||||
@IsNumber()
|
||||
@Type(() => Number)
|
||||
@Min(0)
|
||||
@Max(100)
|
||||
occupancyRate!: number;
|
||||
|
||||
@ApiProperty({ example: 225, description: 'Diện tích còn trống (ha)' })
|
||||
@IsNumber()
|
||||
@Type(() => Number)
|
||||
@Min(0)
|
||||
remainingAreaHa!: number;
|
||||
|
||||
@ApiPropertyOptional({ example: 150 })
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
@Type(() => Number)
|
||||
@Min(0)
|
||||
tenantCount?: number;
|
||||
|
||||
@ApiPropertyOptional({ example: 2005 })
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
@Type(() => Number)
|
||||
establishedYear?: number;
|
||||
|
||||
@ApiPropertyOptional({ example: 80, description: 'Giá thuê đất (USD/m²/năm)' })
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
@Type(() => Number)
|
||||
landRentUsdM2Year?: number;
|
||||
|
||||
@ApiPropertyOptional({ example: 5.0, description: 'Giá thuê nhà xưởng xây sẵn (USD/m²/tháng)' })
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
@Type(() => Number)
|
||||
rbfRentUsdM2Month?: number;
|
||||
|
||||
@ApiPropertyOptional({ example: 4.0, description: 'Giá thuê kho xây sẵn (USD/m²/tháng)' })
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
@Type(() => Number)
|
||||
rbwRentUsdM2Month?: number;
|
||||
|
||||
@ApiPropertyOptional({ example: 0.6 })
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
@Type(() => Number)
|
||||
managementFeeUsd?: number;
|
||||
|
||||
@ApiPropertyOptional({ description: 'Hạ tầng kỹ thuật' })
|
||||
@IsOptional()
|
||||
@IsObject()
|
||||
infrastructure?: Record<string, unknown>;
|
||||
|
||||
@ApiPropertyOptional({ description: 'Kết nối giao thông' })
|
||||
@IsOptional()
|
||||
@IsObject()
|
||||
connectivity?: Record<string, unknown>;
|
||||
|
||||
@ApiPropertyOptional({ description: 'Ưu đãi đầu tư' })
|
||||
@IsOptional()
|
||||
@IsObject()
|
||||
incentives?: Record<string, unknown>;
|
||||
|
||||
@ApiProperty({ example: ['electronics', 'logistics'], description: 'Ngành mục tiêu' })
|
||||
@IsArray()
|
||||
@IsString({ each: true })
|
||||
targetIndustries!: string[];
|
||||
|
||||
@ApiPropertyOptional({ description: 'Mô tả (tiếng Việt)' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
description?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: 'Mô tả (tiếng Anh)' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
descriptionEn?: string;
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
import { ApiPropertyOptional } from '@nestjs/swagger';
|
||||
import { IndustrialParkStatus, VietnamRegion } from '@prisma/client';
|
||||
import { Type } from 'class-transformer';
|
||||
import { IsEnum, IsNumber, IsOptional, IsString, Max, Min } from 'class-validator';
|
||||
|
||||
export class SearchIndustrialParksDto {
|
||||
@ApiPropertyOptional({ example: 'VSIP', description: 'Từ khóa tìm kiếm' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
q?: string;
|
||||
|
||||
@ApiPropertyOptional({ example: 'Bắc Ninh' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
province?: string;
|
||||
|
||||
@ApiPropertyOptional({ enum: VietnamRegion })
|
||||
@IsOptional()
|
||||
@IsEnum(VietnamRegion)
|
||||
region?: VietnamRegion;
|
||||
|
||||
@ApiPropertyOptional({ enum: IndustrialParkStatus })
|
||||
@IsOptional()
|
||||
@IsEnum(IndustrialParkStatus)
|
||||
status?: IndustrialParkStatus;
|
||||
|
||||
@ApiPropertyOptional({ example: 50, description: 'Diện tích trống tối thiểu (ha)' })
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
@Type(() => Number)
|
||||
@Min(0)
|
||||
minAreaHa?: number;
|
||||
|
||||
@ApiPropertyOptional({ example: 100, description: 'Giá thuê đất tối đa (USD/m²/năm)' })
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
@Type(() => Number)
|
||||
maxRentUsdM2?: number;
|
||||
|
||||
@ApiPropertyOptional({ example: 'electronics' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
targetIndustry?: string;
|
||||
|
||||
@ApiPropertyOptional({ example: 1, default: 1 })
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
@Type(() => Number)
|
||||
@Min(1)
|
||||
page?: number;
|
||||
|
||||
@ApiPropertyOptional({ example: 20, default: 20 })
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
@Type(() => Number)
|
||||
@Min(1)
|
||||
@Max(100)
|
||||
limit?: number;
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
import { ApiPropertyOptional } from '@nestjs/swagger';
|
||||
import { IndustrialParkStatus } from '@prisma/client';
|
||||
import { Type } from 'class-transformer';
|
||||
import {
|
||||
IsString,
|
||||
IsNumber,
|
||||
IsEnum,
|
||||
IsOptional,
|
||||
IsArray,
|
||||
IsObject,
|
||||
IsBoolean,
|
||||
Min,
|
||||
Max,
|
||||
} from 'class-validator';
|
||||
|
||||
export class UpdateIndustrialParkDto {
|
||||
@ApiPropertyOptional({ example: 'KCN VSIP Hải Phòng II' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
name?: string;
|
||||
|
||||
@ApiPropertyOptional({ example: 'VSIP Hai Phong II Industrial Park' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
nameEn?: string;
|
||||
|
||||
@ApiPropertyOptional({ example: 'VSIP Group' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
developer?: string;
|
||||
|
||||
@ApiPropertyOptional({ example: 'VSIP Joint Venture' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
operator?: string;
|
||||
|
||||
@ApiPropertyOptional({ enum: IndustrialParkStatus })
|
||||
@IsOptional()
|
||||
@IsEnum(IndustrialParkStatus)
|
||||
status?: IndustrialParkStatus;
|
||||
|
||||
@ApiPropertyOptional({ example: 80 })
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
@Type(() => Number)
|
||||
@Min(0)
|
||||
@Max(100)
|
||||
occupancyRate?: number;
|
||||
|
||||
@ApiPropertyOptional({ example: 180 })
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
@Type(() => Number)
|
||||
@Min(0)
|
||||
remainingAreaHa?: number;
|
||||
|
||||
@ApiPropertyOptional({ example: 160 })
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
@Type(() => Number)
|
||||
@Min(0)
|
||||
tenantCount?: number;
|
||||
|
||||
@ApiPropertyOptional({ example: 85 })
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
@Type(() => Number)
|
||||
landRentUsdM2Year?: number;
|
||||
|
||||
@ApiPropertyOptional({ example: 5.5 })
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
@Type(() => Number)
|
||||
rbfRentUsdM2Month?: number;
|
||||
|
||||
@ApiPropertyOptional({ example: 4.5 })
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
@Type(() => Number)
|
||||
rbwRentUsdM2Month?: number;
|
||||
|
||||
@ApiPropertyOptional({ example: 0.7 })
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
@Type(() => Number)
|
||||
managementFeeUsd?: number;
|
||||
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@IsObject()
|
||||
infrastructure?: Record<string, unknown>;
|
||||
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@IsObject()
|
||||
connectivity?: Record<string, unknown>;
|
||||
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@IsObject()
|
||||
incentives?: Record<string, unknown>;
|
||||
|
||||
@ApiPropertyOptional({ example: ['electronics', 'logistics'] })
|
||||
@IsOptional()
|
||||
@IsArray()
|
||||
@IsString({ each: true })
|
||||
targetIndustries?: string[];
|
||||
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
description?: string;
|
||||
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
descriptionEn?: string;
|
||||
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
isVerified?: boolean;
|
||||
}
|
||||
Reference in New Issue
Block a user