← back to Commercialrealestate
auto-save: 2026-06-30T13:40:46 (1 files) — scripts/seed-frank-arcstone.js
6d18e70f66a8875c2449b56807f337d65ff0462e · 2026-06-30 13:40:56 -0700 · Steve Abrams
Files touched
A scripts/seed-frank-arcstone.js
Diff
commit 6d18e70f66a8875c2449b56807f337d65ff0462e
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Tue Jun 30 13:40:56 2026 -0700
auto-save: 2026-06-30T13:40:46 (1 files) — scripts/seed-frank-arcstone.js
---
scripts/seed-frank-arcstone.js | 56 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 56 insertions(+)
diff --git a/scripts/seed-frank-arcstone.js b/scripts/seed-frank-arcstone.js
new file mode 100644
index 0000000..18c94b5
--- /dev/null
+++ b/scripts/seed-frank-arcstone.js
@@ -0,0 +1,56 @@
+#!/usr/bin/env node
+// seed-frank-arcstone.js — seed "Frank Arcstone" as a SYNTHETIC TEST broker (is_test=true) with a full
+// demo profile: company, sample phone, sample email, and 2 linked sample listings. Because he's synthetic,
+// his card may show the FULL Name/Company/Phone/Email template — that's the demo, not real PII.
+// Idempotent. $0 (local Postgres).
+'use strict';
+const { pool } = require('./db/brokers-db');
+
+async function main() {
+ // 1) is_test flag on broker + listing so the UI/queries can cleanly distinguish synthetic from real.
+ await pool.query(`ALTER TABLE broker ADD COLUMN IF NOT EXISTS is_test boolean NOT NULL DEFAULT false`);
+ await pool.query(`ALTER TABLE listing ADD COLUMN IF NOT EXISTS is_test boolean NOT NULL DEFAULT false`);
+
+ // 2) Synthetic firm.
+ const firmId = (await pool.query(
+ `INSERT INTO firm(name) VALUES('Arcstone Financial (DEMO)')
+ ON CONFLICT(name) DO UPDATE SET name=EXCLUDED.name RETURNING id`)).rows[0].id;
+
+ // 3) Synthetic broker — full demo contact template (clearly synthetic).
+ const b = (await pool.query(
+ `INSERT INTO broker(name, firm_id, title, phone, email, website, source, agent_type, total_assets, enriched_at, is_test)
+ VALUES('Frank Arcstone', $1, 'Senior Loan Advisor (DEMO)', '(818) 555-0142', 'frank.arcstone@example.com',
+ 'https://example.com/frank-arcstone', 'synthetic-test', 'commercial', 12, now(), true)
+ ON CONFLICT(name, firm_id) DO UPDATE SET
+ title=EXCLUDED.title, phone=EXCLUDED.phone, email=EXCLUDED.email, website=EXCLUDED.website,
+ agent_type=EXCLUDED.agent_type, total_assets=EXCLUDED.total_assets, enriched_at=now(), is_test=true
+ RETURNING id`, [firmId])).rows[0];
+ const bid = b.id;
+
+ // 4) Two synthetic sample listings + broker_listing edges (so his card demos a linked book).
+ const samples = [
+ { id: 'demo-frank-1', address: '14820 Ventura Blvd', city: 'Sherman Oaks', zip: '91403',
+ type: 'Mixed-Use', price: 3250000, cap_rate: 5.4, units: 6, firm_name: 'Arcstone Financial (DEMO)' },
+ { id: 'demo-frank-2', address: '6500 Variel Ave', city: 'Woodland Hills', zip: '91367',
+ type: 'Multifamily', price: 4100000, cap_rate: 5.0, units: 9, firm_name: 'Arcstone Financial (DEMO)' }
+ ];
+ for (const l of samples) {
+ await pool.query(
+ `INSERT INTO listing(id, address, city, zip, type, price, cap_rate, units, firm_name, source, is_test)
+ VALUES($1,$2,$3,$4,$5,$6,$7,$8,$9,'synthetic-test',true)
+ ON CONFLICT(id) DO UPDATE SET address=EXCLUDED.address, city=EXCLUDED.city, type=EXCLUDED.type,
+ price=EXCLUDED.price, cap_rate=EXCLUDED.cap_rate, units=EXCLUDED.units, firm_name=EXCLUDED.firm_name, is_test=true`,
+ [l.id, l.address, l.city, l.zip, l.type, l.price, l.cap_rate, l.units, l.firm_name]);
+ await pool.query(
+ `INSERT INTO broker_listing(broker_id, listing_id, role) VALUES($1,$2,'lead') ON CONFLICT DO NOTHING`,
+ [bid, l.id]);
+ }
+
+ const chk = (await pool.query(
+ `SELECT b.id, b.name, b.is_test, f.name firm, b.phone, b.email,
+ (SELECT count(*) FROM broker_listing WHERE broker_id=b.id)::int listings
+ FROM broker b JOIN firm f ON f.id=b.firm_id WHERE b.id=$1`, [bid])).rows[0];
+ console.log('[seed] Frank Arcstone seeded:', JSON.stringify(chk));
+ await pool.end();
+}
+main().catch(e => { console.error('[seed] FAILED:', e.message); process.exit(1); });
← ee71adf CRE :9911 — front-page broker contacts (name/company/phone/e
·
back to Commercialrealestate
·
CRE :9911 — 'Best leads for Frank' ranked list: expandable M 69ac4d3 →