Upgrade Companies page: stats, delete, status badge, dropdown menu

Server:
- companyService.stats() returns per-company agent/issue counts in one query pair
- companyService.remove() cascades deletes across all child tables in dependency order
- GET /companies/stats endpoint (board-accessible)
- DELETE /companies/:companyId endpoint (board-only)

UI:
- Companies page shows agent count, issue count, spend/budget, and created-at per card
- Company status shown as a colored badge (active/paused/archived)
- Three-dot dropdown menu with Rename and Delete Company actions
- Inline delete confirmation to prevent accidental data loss
- 'New Company' button opens onboarding wizard instead of inline form

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Forgotten
2026-02-17 20:14:05 -06:00
parent 00de7e46f1
commit fb8a77a53b
5 changed files with 248 additions and 14 deletions

View File

@@ -14,6 +14,11 @@ export function companyRoutes(db: Db) {
res.json(result);
});
router.get("/stats", async (_req, res) => {
const stats = await svc.stats();
res.json(stats);
});
router.get("/:companyId", async (req, res) => {
const companyId = req.params.companyId as string;
const company = await svc.getById(companyId);
@@ -78,5 +83,16 @@ export function companyRoutes(db: Db) {
res.json(company);
});
router.delete("/:companyId", async (req, res) => {
assertBoard(req);
const companyId = req.params.companyId as string;
const company = await svc.remove(companyId);
if (!company) {
res.status(404).json({ error: "Company not found" });
return;
}
res.json({ ok: true });
});
return router;
}