[object Object]

← back to Commercialrealestate

agent-profile: add firm_listings (direct-from-firm-site inventory via firm_name match, labeled — not claimed as the agent's own)

c395270014619f7eec28e8bf8e5cd048572600b9 · 2026-08-19 09:39:26 -0700 · Steve Abrams

Files touched

Diff

commit c395270014619f7eec28e8bf8e5cd048572600b9
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Wed Aug 19 09:39:26 2026 -0700

    agent-profile: add firm_listings (direct-from-firm-site inventory via firm_name match, labeled — not claimed as the agent's own)
---
 scripts/serve.js | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/scripts/serve.js b/scripts/serve.js
index 3ceb5f1..deb920c 100644
--- a/scripts/serve.js
+++ b/scripts/serve.js
@@ -359,11 +359,18 @@ app.get('/api/agent-profile', async (req, res) => {
     const closed = (await brokerdb.pool.query(
       `SELECT address, city, sold_price, sold_date, type, source
          FROM broker_closed_listing WHERE broker_id = $1 ORDER BY sold_date DESC NULLS LAST`, [b.id]).catch(() => ({ rows: [] }))).rows;
+    // FIRM listings — direct-from-firm-site inventory (openclaw+LLM, source=broker-site-oc), matched
+    // by the agent's firm. Shown labeled "Firm listings", NOT claimed as this agent's personal book.
+    const firmListings = b.firm ? (await brokerdb.pool.query(
+      `SELECT address, city, zip, type, price, units, cap_rate
+         FROM listing WHERE source='broker-site-oc' AND lower(firm_name)=lower($1)
+        ORDER BY price DESC NULLS LAST`, [b.firm]).catch(() => ({ rows: [] }))).rows : [];
     res.json({
       found: true, id: b.id, name: b.name, firm: b.firm, phone: b.phone, email: b.email,
       title: b.title, agent_type: b.agent_type, license: b.license, office: b.office_addr, linkedin: b.linkedin,
       listings, count: listings.length,
       closed, closed_count: closed.length,
+      firm_listings: firmListings, firm_count: firmListings.length,
       total_value: listings.reduce((s, l) => s + Number(l.price || 0), 0),
       closed_value: closed.reduce((s, l) => s + Number(l.sold_price || 0), 0),
       cities: [...new Set(listings.map(l => l.city).concat(closed.map(l => l.city)).filter(Boolean))],

← 6939e72 auto-data-snapshot: 2026-08-19T09:34:55 (1 data files) — dat  ·  back to Commercialrealestate  ·  agent.html: render labeled 'Firm listings' section (firm-sit c45525e →