app: the demo scenarios (APP-1.0-PLAN §12)

npm run demo loads Acacia Hill; --profile/--scenario any of the eight
demo churches, around @crosscode/demo's people (the same account ids
as Accounts), in the scenario's active-member band: a prayer wall with
three months of commitments and the scenario's gaps, a campaign,
testimonies, prayer requests, announcements, the church's own
devotionals or Cross Code's from the Hub, and events (Cross Events' or
the Website's through the feed when linked, else the App's own).

The devotionals' passages are copied word for word from the public-
domain KJV and BSB by scripts/demo-passages.ts (no Bible text written
by hand). The sender never sends anything to a demo person.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-01 15:43:48 +02:00
co-authored by Claude Opus 5.5
parent c7e446a239
commit acd3b259a1
11 changed files with 1213 additions and 3 deletions
+6 -1
View File
@@ -1,7 +1,7 @@
/**
* An in-memory stand-in for the Prisma client (from the Website's tests/support/memoryDb.ts): every
* model the App uses, with the schema's defaults and unique fields, generic `where` matching
* (equality, in / notIn, gt / gte / lt / lte, not, contains, has, AND / OR), `include` of the
* (equality, in / notIn, gt / gte / lt / lte, not, contains, endsWith, has, AND / OR), `include` of the
* relations below and `aggregate` sums. Enough to run the whole app in tests. Each module adds its
* models' defaults here as it arrives.
*/
@@ -61,6 +61,7 @@ function matchValue(actual: unknown, cond: unknown): boolean {
case 'not': return x === null ? actual != null : !matchValue(actual, x);
case 'isEmpty': return Array.isArray(actual) && (actual.length === 0) === x;
case 'has': return Array.isArray(actual) && actual.map(v).includes(v(x));
case 'endsWith': return typeof actual === 'string' && (insensitive ? actual.toLowerCase().endsWith(String(x).toLowerCase()) : actual.endsWith(String(x)));
case 'contains': return typeof actual === 'string' && (insensitive ? actual.toLowerCase().includes(String(x).toLowerCase()) : actual.includes(String(x)));
default: throw new Error(`memoryDb: no operator ${op}`);
}
@@ -149,6 +150,10 @@ function model(name: string, tables: Map<string, Map<unknown, Row>>) {
table().set(row[key], row);
return clone(row);
},
createMany: async ({ data }: { data: Row[] }) => {
for (const d of data) await api.create({ data: d });
return { count: data.length };
},
update: async ({ where, data }: { where: Row; data: Row }) => {
const r = findWhere(where);
if (!r) throw prismaError('P2025', `Record to update not found (${name})`);