← back to Nationalrealestate
firm API: surface phone/website/street_address in /api/brokers + /api/firms + /api/firm/:id so RENTV/CRCP proxies render the full contact card (TK-10669)
d1ab982098f02cfd9499acb0556966087dd2b7e2 · 2026-08-18 09:23:22 -0700 · Steve Abrams
Files touched
Diff
commit d1ab982098f02cfd9499acb0556966087dd2b7e2
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Tue Aug 18 09:23:22 2026 -0700
firm API: surface phone/website/street_address in /api/brokers + /api/firms + /api/firm/:id so RENTV/CRCP proxies render the full contact card (TK-10669)
---
src/server/index.ts | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/server/index.ts b/src/server/index.ts
index 910a782..023f160 100644
--- a/src/server/index.ts
+++ b/src/server/index.ts
@@ -395,9 +395,11 @@ app.get('/api/brokers', async (req, res) => {
b.city, b.state_code, b.source, f.name AS firm_name, f.id AS firm_id,
b.phone AS broker_phone, b.email AS broker_email, b.website AS broker_website, b.website_status,
COALESCE(fs.url, f.website) AS firm_website,
+ f.street_address AS firm_address,
-- firm-level contact fallback (the agent's own phone/email is usually blank on the DRE
- -- registry; the firm's crawled contact is the next-best reachable number/inbox).
- (SELECT value FROM firm_contacts WHERE firm_id = f.id AND kind = 'phone' ORDER BY id LIMIT 1) AS firm_phone,
+ -- registry). Prefer the registry-grade firm.phone (Google Places resolve, TK-10669);
+ -- fall back to the firm's crawled contact number.
+ COALESCE(NULLIF(f.phone,''), (SELECT value FROM firm_contacts WHERE firm_id = f.id AND kind = 'phone' ORDER BY id LIMIT 1)) AS firm_phone,
(SELECT value FROM firm_contacts WHERE firm_id = f.id AND kind = 'email' ORDER BY id LIMIT 1) AS firm_email,
COUNT(*) OVER()::int AS total
FROM broker b
@@ -434,6 +436,7 @@ app.get('/api/firms', async (req, res) => {
params.push(limit, offset);
const r = await query(
`SELECT id, name, license_no, license_state, hq_city, hq_state, agent_count, source, asset_class,
+ website, phone, street_address,
COUNT(*) OVER()::int AS total
FROM firm
${where}
← 771e7f8 firm directory: capture + surface street address via Places
·
back to Nationalrealestate
·
firm email collection: crawl public contact emails off firm 5a7ce2a →