Hub 2.12.0: one product uninstalled at a time, stale installs removed, customers archived

- Uninstalls name the product (agent 1.5.0); a whole-church uninstall marks every product
  of the church on that server removed. Older agents are refused while the church has others.
- A second product's uninstall joins one already planned (one export and one uninstall) or
  gets its own time; the last product removes the whole church. Accounts goes last.
- Remove an install from the Hub after 24 hours without a heartbeat (POST .../forget).
- Archive and restore customers (migration 20261123090000_customer_archive).
- Several addresses for a customer's email and billing email, with a + button.
- Statements show R0 invoices' amounts. Vendors contracts 1.16.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-23 09:17:35 +02:00
co-authored by Claude Opus 5.5
parent f3bee827e5
commit 3a00271a02
25 changed files with 683 additions and 61 deletions
+10 -2
View File
@@ -198,7 +198,15 @@ router.post('/deployments/link', wrap(async (req, res) => {
router.get('/deployments/:id', wrap(async (req, res) => {
const d = await prisma.deployment.findUnique({ where: { id: req.params.id }, include: { server: true, customer: { select: { id: true, name: true } }, install: true, jobs: { orderBy: { createdAt: 'desc' }, take: 50 }, exports: { select: { id: true, bytes: true, expiresAt: true, downloadedAt: true, deletedAt: true, createdAt: true } } } });
if (!d) throw bad('Not found.', 404);
res.json({ deployment: { ...d, server: serverSummary(d.server) }, fastPanel: await jobs.fastPanelText(d), canRemoveRecord: await jobs.neverInstalled(d) });
res.json({ deployment: { ...d, server: serverSummary(d.server) }, fastPanel: await jobs.fastPanelText(d), canRemoveRecord: await jobs.neverInstalled(d), stale: jobs.staleness(d), uninstall: await jobs.uninstallPlan(d) });
}));
// Hub 2.12.0: an install that's no longer on its server (no heartbeat for 24 hours), removed from
// the Hub only: nothing runs on the server.
router.post('/deployments/:id/forget', wrap(async (req, res) => {
const d = await jobs.forgetStale(req.params.id, { confirm: req.body?.confirm });
await audit(req, 'install_removed_from_hub', d.id, { shortName: d.shortName, product: d.product, server: d.serverId, lastHeardAt: jobs.staleness(d).since });
res.json({ ok: true });
}));
// A failed install's record (nothing of it is on the server, so there's nothing to uninstall).
@@ -252,7 +260,7 @@ router.post('/deployments/:id/seed-demo', wrap(async (req, res) => {
}));
router.post('/deployments/:id/uninstall', wrap(async (req, res) => {
const out = await jobs.scheduleUninstall({ deploymentId: req.params.id, at: req.body?.at, totp: req.body?.totp, confirm: req.body?.confirm }, req.admin);
const out = await jobs.scheduleUninstall({ deploymentId: req.params.id, at: req.body?.at, totp: req.body?.totp, confirm: req.body?.confirm, join: typeof req.body?.join === 'boolean' ? req.body.join : undefined, joinJobId: req.body?.joinJobId || undefined }, req.admin);
await audit(req, 'uninstall_scheduled', req.params.id, { at: out.uninstallJob.notBefore });
res.status(201).json(out);
}));