Hub 2.25.0: demo clients, and demo data for the Church Website
- A customer can be a demo client: every install a demo site (Accounts included, and any later install), never billed (billing off, no invoice drafted, sent or made by hand). Migration: Customer.isDemo, demoSince. - Any install can be marked as a demo site; Events and the Website have demo data. The Website's eight demo churches need agent 1.6.0. - Contracts 1.19.0 vendored. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -216,7 +216,7 @@ 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 } } } });
|
||||
const d = await prisma.deployment.findUnique({ where: { id: req.params.id }, include: { server: true, customer: { select: { id: true, name: true, isDemo: 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), stale: jobs.staleness(d), uninstall: await jobs.uninstallPlan(d) });
|
||||
}));
|
||||
@@ -255,6 +255,14 @@ router.post('/deployments/:id/demo', wrap(async (req, res) => {
|
||||
res.json({ isDemo: d.isDemo });
|
||||
}));
|
||||
|
||||
// Demo clients (2.25.0): every install a demo site, Accounts included, and never billed.
|
||||
router.post('/customers/:id/demo', wrap(async (req, res) => {
|
||||
const isDemo = req.body?.isDemo === true;
|
||||
const { customer, sites, warnings } = await jobs.setCustomerDemo(req.params.id, { isDemo, confirm: req.body?.confirm });
|
||||
await audit(req, isDemo ? 'customer_marked_demo' : 'customer_unmarked_demo', customer.id, { name: customer.name, sites });
|
||||
res.json({ isDemo: customer.isDemo, sites, warnings });
|
||||
}));
|
||||
|
||||
// An install's .env (2.8.0): the last read (secrets only as set or not), read it again, change values.
|
||||
router.get('/deployments/:id/env', wrap(async (req, res) => {
|
||||
res.json(await jobs.envState(req.params.id));
|
||||
|
||||
Reference in New Issue
Block a user