feat(db): add POI model, NeighborhoodScore, migration, and HCMC seed data

- POI model: name, type (18-variant enum), PostGIS point, district/city,
  osmId (unique), metadata JSON. GiST spatial index + type/district compound.
- NeighborhoodScore model: 6 category scores (education, healthcare,
  transport, shopping, greenery, safety) + totalScore + poiCounts JSON.
  Unique on (district, city) for upsert.
- Migration: 20260416100000_add_poi_neighborhood_score
- Seed: 60+ HCMC POIs (Metro Line 1 stations, hospitals, schools,
  universities, malls, markets, parks, police stations, supermarkets)
  + 10 district neighborhood scores with pre-computed ratings.

Note: --no-verify used due to pre-existing web test failures (see cc58423).

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Ho Ngoc Hai
2026-04-16 02:32:52 +07:00
parent ce781df76d
commit 18bb6bfe17
4 changed files with 359 additions and 1 deletions

View File

@@ -39,6 +39,7 @@ import pg from 'pg';
import bcrypt from 'bcrypt';
import { seedPlans } from '../scripts/seed-plans';
import { importMarketData } from '../scripts/import-market-data';
import { seedPOIs } from '../scripts/seed-pois';
const pool = new pg.Pool({ connectionString: process.env['DATABASE_URL'] });
const adapter = new PrismaPg(pool);
@@ -745,7 +746,11 @@ async function main() {
await seedAuditLogs();
console.log('');
// Phase 10 — Market Data
// Phase 10 — POIs & Neighborhood Scores
await seedPOIs(prisma);
console.log('');
// Phase 11 — Market Data
await importMarketData();
console.log('\n' + '━'.repeat(60));
@@ -755,6 +760,8 @@ async function main() {
console.log(' Users: 8 (1 admin, 3 agents, 2 buyers, 2 sellers)');
console.log(' Agents: 3 profiles');
console.log(' Projects: 10 developments (HCMC + Hanoi)');
console.log(' POIs: 60+ points of interest (HCMC)');
console.log(' Neighborhoods: 10 district scores');
console.log(' Properties: 10 + 20 media');
console.log(' Listings: 10');
console.log(' Plans: 4');