diff --git a/api/src/routes/corp-status.ts b/api/src/routes/corp-status.ts
index de6dfa6..1375666 100644
--- a/api/src/routes/corp-status.ts
+++ b/api/src/routes/corp-status.ts
@@ -246,24 +246,35 @@ router.get("/api/v1/corp/search", async (req: Request, res: Response) => {
res.status(400).json({ error: "q parameter required (min 2 chars)" });
return;
}
- if (!state || state.length !== 2) {
- res.status(400).json({ error: "state parameter required (2-letter code)" });
- return;
- }
+
+ const limit = Math.min(Number(req.query.limit) || 10, 20);
try {
- const { rows } = await pool.query(
- `SELECT entity_name, entity_number, entity_type, status, formation_date,
- similarity(entity_name, $2) AS sim
- FROM entity_cache
- WHERE state = $1 AND entity_name % $2
- ORDER BY sim DESC
- LIMIT 10`,
- [state, q],
- );
+ // State is optional — if omitted, search all states
+ const { rows } = state
+ ? await pool.query(
+ `SELECT entity_name, entity_number, entity_type, status, formation_date,
+ registered_agent, principal_address, state,
+ similarity(entity_name, $2) AS sim
+ FROM entity_cache
+ WHERE state = $1 AND entity_name % $2
+ ORDER BY sim DESC
+ LIMIT $3`,
+ [state, q, limit],
+ )
+ : await pool.query(
+ `SELECT entity_name, entity_number, entity_type, status, formation_date,
+ registered_agent, principal_address, state,
+ similarity(entity_name, $2) AS sim
+ FROM entity_cache
+ WHERE entity_name % $1
+ ORDER BY sim DESC
+ LIMIT $2`,
+ [q, limit],
+ );
res.json({
- state,
+ state: state || "all",
query: q,
count: rows.length,
results: rows.map((r: any) => ({
@@ -274,11 +285,14 @@ router.get("/api/v1/corp/search", async (req: Request, res: Response) => {
formation_date: r.formation_date
? new Date(r.formation_date).toISOString().slice(0, 10)
: null,
+ registered_agent: r.registered_agent || null,
+ principal_address: r.principal_address || null,
+ state: r.state || null,
})),
});
} catch (err: any) {
if (err?.code === "42P01") {
- res.json({ state, query: q, count: 0, results: [], note: "Entity database not yet populated for this state." });
+ res.json({ state: state || "all", query: q, count: 0, results: [], note: "Entity database not yet populated for this state." });
} else {
console.error("[corp/search] Error:", err);
res.status(500).json({ error: "Search failed" });
diff --git a/site/src/components/intake/steps/OfficerStep.astro b/site/src/components/intake/steps/OfficerStep.astro
index 8f698b3..0d96d88 100644
--- a/site/src/components/intake/steps/OfficerStep.astro
+++ b/site/src/components/intake/steps/OfficerStep.astro
@@ -15,6 +15,12 @@
a sole proprietor gives 1; a corporation gives 3.
+
+
+
We found corporate records that may match. Select to auto-fill:
+
+
+