← back to Nationalrealestate
Add /api/commercial/digest — one-shot marquee+briefs/recent/firms payload for RENTV syndication
253038dad6b84ffcdae0adcb33624a148ed1ce53 · 2026-07-22 11:03:18 -0700 · Steve
Files touched
M src/server/commercial.ts
Diff
commit 253038dad6b84ffcdae0adcb33624a148ed1ce53
Author: Steve <steve@designerwallcoverings.com>
Date: Wed Jul 22 11:03:18 2026 -0700
Add /api/commercial/digest — one-shot marquee+briefs/recent/firms payload for RENTV syndication
---
src/server/commercial.ts | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/src/server/commercial.ts b/src/server/commercial.ts
index c25fbbf..2dde07a 100644
--- a/src/server/commercial.ts
+++ b/src/server/commercial.ts
@@ -122,6 +122,32 @@ export function mountCommercial(app: Express) {
} catch (e: any) { res.status(500).json({ error: String(e.message || e) }); }
});
+ // one-shot digest for syndication (e.g. RENTV): marquee+briefs, recent activity, top LA firms
+ app.get('/api/commercial/digest', async (req: Request, res: Response) => {
+ try {
+ const county = String(req.query.county || COUNTY);
+ const [marquee, recent, firms] = await Promise.all([
+ query(`SELECT p.*, b.brief FROM commercial_parcel p
+ LEFT JOIN commercial_brief b ON b.county_fips=p.county_fips AND b.ain=p.ain
+ WHERE p.county_fips=$1 AND p.assessed_total IS NOT NULL AND b.brief IS NOT NULL
+ ORDER BY p.assessed_total DESC LIMIT 12`, [county]),
+ query(`SELECT p.*, b.brief FROM commercial_parcel p
+ LEFT JOIN commercial_brief b ON b.county_fips=p.county_fips AND b.ain=p.ain
+ WHERE p.county_fips=$1 AND p.recording_date IS NOT NULL
+ ORDER BY p.recording_date DESC, p.assessed_total DESC NULLS LAST LIMIT 20`, [county]),
+ query(`SELECT name, agent_count, hq_city, license_no FROM firm
+ WHERE license_state='CA' AND upper(hq_city)='LOS ANGELES' AND agent_count>0
+ ORDER BY agent_count DESC NULLS LAST LIMIT 12`),
+ ]);
+ res.json({
+ fetched_at: new Date().toISOString(), county,
+ marquee: marquee.rows.map(r => ({ ...shape(r), brief: r.brief || null })),
+ recent: recent.rows.map(r => ({ ...shape(r), brief: r.brief || null })),
+ firms: firms.rows.map((f: any) => ({ name: f.name, agent_count: f.agent_count, city: f.hq_city, license_no: f.license_no })),
+ });
+ } catch (e: any) { res.status(500).json({ error: String(e.message || e) }); }
+ });
+
// generated news blurb for one asset (precomputed by ingest:commercial-briefs)
app.get('/api/commercial/brief/:ain', async (req: Request, res: Response) => {
try {
← 17cdf50 refresh-commercial: gate briefs on explicit REFRESH_BRIEFS=1
·
back to Nationalrealestate
·
add sublease inventory: table + /api/sublease GET + gated ad aa180e3 →