feat(website): the admin, with drafts, preview, publish and restore
Admin API and screens: dashboard and setup checklist, template and style, pages and blocks, ministries, leadership, media library with the storage limit, publish and history. Pending changes with who and when, discard one, one Publish, restore any version (each version keeps the working copy's rows, never sent to visitors). Preview on the site's own addresses with a bar (widths, back, publish); shared preview links for 7 days or until revoked. Roles checked, same-origin changes only. Publish refreshes the public pages at once (WEBSITE_CONTENT_CACHE_SECONDS). E2E on a production build: the admin's flows and axe on every screen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -15,6 +15,7 @@ import { createApp } from '../backend/src/app.js';
|
||||
import { createCtx } from '../backend/src/context.js';
|
||||
import { loadDemo } from '../backend/src/demo/demoChurch.js';
|
||||
import { loadConfig } from '../backend/src/lib/config.js';
|
||||
import { hashToken } from '../backend/src/lib/crypto.js';
|
||||
import { publish } from '../backend/src/site/snapshot.js';
|
||||
import { memoryDb } from '../backend/tests/support/memoryDb.js';
|
||||
|
||||
@@ -43,5 +44,14 @@ app.post('/test/design', express.json(), async (req, res) => {
|
||||
const v = await publish(ctx, { id: 'e2e', role: 'system' });
|
||||
res.json({ ok: true, version: v.number });
|
||||
});
|
||||
// A signed-in admin without Accounts: the role's user and a session; the spec sets the cookie.
|
||||
app.post('/test/session', async (req, res) => {
|
||||
const role = String(req.query.role ?? 'editor');
|
||||
const id = `00000000-0000-4000-8000-${String(Math.floor(Math.random() * 1e12)).padStart(12, '0')}`;
|
||||
const token = `e2e-${id}`;
|
||||
await db.websiteUser.create({ data: { id, name: `Test ${role}`, email: `${id}@hope.test`, role: role as never } });
|
||||
await db.session.create({ data: { tokenHash: hashToken(token), userId: id, expiresAt: new Date(Date.now() + 864e5) } });
|
||||
res.json({ cookie: { name: 'ccw_session', value: token } });
|
||||
});
|
||||
app.use(createApp(ctx));
|
||||
app.listen(5310, '127.0.0.1', () => console.log('[e2e] Website backend on 5310 with the demo church.'));
|
||||
|
||||
Reference in New Issue
Block a user