Data → Venues: a map picture with its locations marked as pins or boxes (088). A Map block draws a venue with its locations listed; a schedule names a venue and its entries pick a location, linking to the map on the page with it lit up. Entries and sub-items can name an event (a workshop) and take what they leave blank from it, and an Events block shows event cards. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
558 lines
26 KiB
JavaScript
558 lines
26 KiB
JavaScript
/* ═══════════════════════════════════════════════════════════════
|
|
SHOWCASE: test records with every field filled in
|
|
|
|
DB_PATH=./dev.db node src/seed-showcase.js
|
|
DB_PATH=./dev.db node src/seed-showcase.js --listed
|
|
DB_PATH=/var/lib/ngu/ngu.db node src/seed-showcase.js --production
|
|
|
|
Writes one of each record kind with every field and option used,
|
|
so a change to any page can be checked against a record that
|
|
exercises all of it:
|
|
|
|
/regions/showcase-region region: areas, map note, links, blocks
|
|
/groups/showcase-group group: meets, started, region
|
|
/teams/showcase-team team: a lead and members
|
|
/awards/showcase-award award: recipients, one at an event
|
|
/people/showcase-person person: bio, links, roles past and
|
|
current, events, awards, private data
|
|
/events/showcase-event upcoming retreat: hosts, billed
|
|
people, links, blocks, background,
|
|
a three-day schedule
|
|
/events/showcase-series weekly series with times
|
|
/events/showcase-past-event past event where the award was given
|
|
/blog/content-block-showcase every content block type
|
|
|
|
Everything is test data: ids start with showcase- (the blog post
|
|
is content-block-showcase), names say Showcase, and contact
|
|
details use example.org and 555 numbers. Run it again to put it
|
|
all back as written here; it replaces these records and nothing
|
|
else.
|
|
|
|
Published but unlisted by default: every page above works, and
|
|
none of it shows in the site's lists, counts, map or QR page.
|
|
One consequence: a region's page lists only listed groups,
|
|
teams, awards and events, so the showcase region's are empty.
|
|
--listed lists everything instead, and
|
|
adds timeline entries, so the Community map, Retreats bands,
|
|
calendar, History page and front page counts can be checked too.
|
|
Run without it again to take them back out.
|
|
|
|
Images point at /uploads/showcase.jpg. Upload any photo in
|
|
Admin → Tools → Media and copy it to that name in the uploads directory,
|
|
or leave it missing to check how each page copes without one.
|
|
|
|
A database under /var/lib/ngu (where the deployed service keeps
|
|
its data) is refused unless --production is given too. That's for
|
|
a server that exists to be tested; on the live site, back up the
|
|
database first and leave --listed off, so the showcase is only
|
|
reachable by its links.
|
|
═══════════════════════════════════════════════════════════════ */
|
|
|
|
import { openDatabase, migrate, tx } from "./db.js";
|
|
|
|
const DB_PATH = process.env.DB_PATH ?? "./ngu.db";
|
|
const LISTED = process.argv.includes("--listed") ? 1 : 0;
|
|
const PRODUCTION = process.argv.includes("--production");
|
|
|
|
// Matched anywhere in the path, not only at its start, so a shell
|
|
// that rewrites /var/lib/... into its own form (Git Bash) is caught too.
|
|
const deployed = /(^|\/)var\/lib\/ngu(\/|$)/.test(DB_PATH.replace(/\\/g, "/"));
|
|
|
|
if (deployed && !PRODUCTION) {
|
|
console.error(
|
|
`✗ ${DB_PATH} is a deployed database. This writes test content;\n` +
|
|
" add --production if that's what you mean.",
|
|
);
|
|
process.exit(1);
|
|
}
|
|
if (deployed) console.warn(`! Writing showcase records to the deployed database ${DB_PATH}.`);
|
|
|
|
const IMAGE = "/uploads/showcase.jpg";
|
|
const POST_ID = "content-block-showcase";
|
|
|
|
const REGION = "showcase-region";
|
|
const GROUP = "showcase-group";
|
|
const TEAM = "showcase-team";
|
|
const AWARD = "showcase-award";
|
|
const PERSON = "showcase-person";
|
|
const MEMBERS = ["showcase-member-1", "showcase-member-2", "showcase-member-3"];
|
|
const EVENT = "showcase-event";
|
|
const SERIES = "showcase-series";
|
|
const PAST = "showcase-past-event";
|
|
const VENUE = "showcase-venue";
|
|
|
|
/* ── Content ───────────────────────────────────────────────── */
|
|
|
|
/* A schedule over three days, using every entry field and kind: a
|
|
plain entry, one with a location and person, one folding out with
|
|
a description, graphic and map, one linked, a heading, a featured
|
|
entry, a block with sub-items, a break, typed and picked times,
|
|
tags (one a tab of its own in its color, one with No tab), and one
|
|
with no day (it lands in a tab of its own). Its venue's locations
|
|
(088) are picked on some entries, one with no typed Location, and
|
|
one sub-item is the showcase workshop, filled in from it. */
|
|
const SCHEDULE = [
|
|
"schedule",
|
|
{ text: "The weekend at a glance. Tap an entry for more.", venue_id: VENUE },
|
|
[
|
|
{ day: "Friday", start_time: "16:00", text: "Arrivals and check-in", location: "Front desk", tags: "showcase-youth,showcase-all" },
|
|
{ day: "Friday", kind: "heading", text: "Evening", detail: "A heading across the day" },
|
|
{ day: "Friday", time: "7:00 to 8:30pm", text: "Opening session", location_key: "hall", person_id: "showcase-person", detail: "Welcome and worship", description: "The **opening session** sets the theme for the weekend.\n\nBring a notebook.", media: "/uploads/showcase.jpg", map: "Camp Hebron, Halifax PA", map_image: "/uploads/showcase.jpg" },
|
|
{ day: "Saturday", start_time: "08:00", end_time: "09:00", kind: "break", text: "Breakfast", location: "Dining hall" },
|
|
{ day: "Saturday", start_time: "09:00", end_time: "10:30", kind: "block", text: "Workshops", location: "Classrooms", detail: "Pick one of three", items: [
|
|
{ start_time: "09:00", end_time: "09:45", text: "Leading worship", location: "Room A", location_key: "rooma", person_id: "showcase-member-2", url: "/blog/content-block-showcase" },
|
|
{ start_time: "09:00", end_time: "09:45", text: "Showcase Past Workshop", event_id: PAST, location_key: "rooma" },
|
|
{ start_time: "09:00", end_time: "09:45", text: "Speaking with confidence", location: "Room B", featured: 1, tags: "showcase-youth", description: "A featured sub-item that folds out." },
|
|
{ time: "After the first round", text: "Open questions", location: "Room C" },
|
|
] },
|
|
{ day: "Saturday", start_time: "19:00", featured: 1, tags: "showcase-youth", text: "Talent night", location: "Main Hall", location_key: "hall", person_id: "showcase-member-3", description: "Sign up at the front desk by noon." },
|
|
{ day: "Sunday", time: "10:00am", text: "Closing service", location: "Chapel", map: "Main Street, Halifax PA" },
|
|
{ time: "Any time", text: "Quiet room open", location: "Library", detail: "An entry with no day" },
|
|
],
|
|
[
|
|
{ tag_key: "showcase-youth", name: "Youth", color: "#00748a" },
|
|
{ tag_key: "showcase-all", name: "Everyone", no_tab: 1 },
|
|
],
|
|
];
|
|
|
|
/* Every block type, for the blog showcase. [type, fields, items?] */
|
|
const ALL_BLOCKS = [
|
|
["paragraph", { text: "Every content block type, top to bottom, with each of its options. Use it to check the page after changing how blocks draw." }],
|
|
["heading", { text: "Heading" }],
|
|
["subheading", { text: "Subheading" }],
|
|
["paragraph", { text: "A paragraph with **bold**, *italic*, a [link to the history page](/history) and an [outside link](https://example.org).\nThis line follows a single line break.\n\nA blank line starts a second paragraph in the same block." }],
|
|
["paragraph", { text: "A whole paragraph that is a link, set with the block's Link field.", href: "/community" }],
|
|
["callout", { text: "**A callout.** For a note or an announcement. It takes the same formatting as a paragraph, including [links](/give)." }],
|
|
["quote", { text: "Unity is not a feeling we wait for. It is a practice we keep.", cite: "A retreat speaker" }],
|
|
["quote", { text: "A quote with no attribution." }],
|
|
["divider", {}],
|
|
["subheading", { text: "Lists" }],
|
|
["list", {}, [
|
|
{ text: "A plain item" },
|
|
{ text: "An item with a detail", detail: "the detail" },
|
|
{ text: "A linked item", url: "/retreats" },
|
|
{ text: "A linked item with a detail", url: "https://example.org", detail: "opens in a new tab" },
|
|
]],
|
|
["links", {}, [
|
|
{ text: "Retreats", url: "/retreats" },
|
|
{ text: "Community", url: "/community" },
|
|
{ text: "An outside site", url: "https://example.org" },
|
|
]],
|
|
["button", { text: "A button", href: "/give" }],
|
|
["divider", {}],
|
|
["subheading", { text: "Images" }],
|
|
["image", { media: IMAGE, alt: "Describe the picture here", text: "An image with a caption and alt text" }],
|
|
["image", { media: IMAGE, alt: "The same picture, linked", href: "/history" }],
|
|
["subheading", { text: "Schedule" }],
|
|
SCHEDULE,
|
|
["subheading", { text: "Map" }],
|
|
["map", { venue_id: VENUE }],
|
|
["subheading", { text: "Events" }],
|
|
["events", {}, [
|
|
{ event_id: PAST, text: "Showcase Past Workshop" },
|
|
{ event_id: "showcase-event", text: "A card with its own title", detail: "And its own text in place of the event's." },
|
|
]],
|
|
["subheading", { text: "Video" }],
|
|
["video", { href: "https://www.youtube.com/watch?v=dQw4w9WgXcQ", text: "A YouTube video, with its own thumbnail" }],
|
|
["video", { href: "https://vimeo.com/76979871", media: IMAGE, text: "A Vimeo video with an uploaded still" }],
|
|
["subheading", { text: "Table" }],
|
|
["table", { text: [
|
|
"Platform | Monthly cost | Best for | Notes",
|
|
"[Zeffy](https://www.zeffy.com) | Free | Fee-free giving | **0%** to the church",
|
|
"Breeze | $72 | Small churches | Flat price, all features",
|
|
"A cell with a bar \\| in it | Blank cells follow | |",
|
|
].join("\n") }],
|
|
["subheading", { text: "Link cards" }],
|
|
["cards", {}, [
|
|
{ text: "A card with a picture", detail: "Its description, up to three lines, under the title. The whole card is the link.", url: "/retreats", media: IMAGE },
|
|
{ text: "An outside link, text only", detail: "The card shows the site it goes to above the title.", url: "https://example.org" },
|
|
]],
|
|
["subheading", { text: "People" }],
|
|
["people", { team_id: TEAM }, [
|
|
{ person_id: PERSON, text: "Picked as an item, with a title" },
|
|
]],
|
|
];
|
|
|
|
/* A record page's body: a handful of types, so it reads like a
|
|
real page rather than a catalog. */
|
|
const pageBody = (what) => [
|
|
["heading", { text: `About this ${what}` }],
|
|
["paragraph", { text: `This is **showcase data** for a ${what} page. Every field on the record is filled in, so anything left blank on the page is something the page doesn't draw.\n\nSee the [content block showcase](/blog/${POST_ID}) for every block type.` }],
|
|
["callout", { text: `**Test content:** made by seed-showcase.js, not a real ${what}.` }],
|
|
["list", {}, [
|
|
{ text: "What we do", detail: "gather, learn, serve" },
|
|
{ text: "Where to start", url: "/community" },
|
|
]],
|
|
["quote", { text: "A line someone said about this place.", cite: "Showcase Person" }],
|
|
["image", { media: IMAGE, alt: "A group photo", text: "A caption for the photo" }],
|
|
["button", { text: "Get involved", href: "/feedback" }],
|
|
];
|
|
|
|
/* Card text: paragraphs only, shown on cards and list rows. Most
|
|
records put it in "both" (the card and the page); the series and
|
|
the past event keep it to the card, to check that it stays off
|
|
their pages. */
|
|
const cardText = (what) => [
|
|
["paragraph", { text: `Showcase ${what}: the short description that appears on its card.` }],
|
|
["paragraph", { text: "A second card paragraph, to check how two read." }],
|
|
];
|
|
|
|
const standardLinks = (name) => [
|
|
{ kind: "action", label: "Register", url: "https://example.org/register", is_primary: 1 },
|
|
{ kind: "action", platform: "discord", label: "Join the Discord", url: "https://discord.com/invite/example" },
|
|
{ kind: "social", platform: "instagram", label: "@showcase", url: "https://instagram.com/showcase" },
|
|
{ kind: "social", platform: "facebook", label: `${name} on Facebook`, url: "https://facebook.com/showcase" },
|
|
{ kind: "social", platform: "youtube", label: "YouTube", url: "https://youtube.com/@showcase" },
|
|
{ kind: "website", label: "Website", url: "https://example.org" },
|
|
{ kind: "email", label: "showcase@example.org", url: "mailto:showcase@example.org" },
|
|
// A second of each, labeled unlike its address: both listed, each
|
|
// going to its own URL.
|
|
{ kind: "website", label: "Our blog", url: "https://example.org/blog" },
|
|
{ kind: "email", label: "Prayer requests", url: "prayer@example.org" },
|
|
];
|
|
|
|
/* ── Writing ───────────────────────────────────────────────── */
|
|
|
|
const db = await openDatabase(DB_PATH);
|
|
migrate(db, { log: () => {} });
|
|
|
|
function insert(table, row) {
|
|
const keys = Object.keys(row);
|
|
return db
|
|
.prepare(`INSERT INTO ${table} (${keys.join(", ")}) VALUES (${keys.map(() => "?").join(", ")})`)
|
|
.run(...keys.map((k) => row[k] ?? null));
|
|
}
|
|
|
|
function blocks(ownerKind, ownerId, slot, list) {
|
|
list.forEach(([type, f, items = [], tags = []], order) => {
|
|
const { lastInsertRowid } = insert("content_blocks", {
|
|
owner_kind: ownerKind,
|
|
owner_id: ownerId,
|
|
slot,
|
|
sort_order: order,
|
|
type,
|
|
...f,
|
|
});
|
|
items.forEach(({ items: subitems = [], ...item }, i) => {
|
|
const entry = insert("content_block_items", { block_id: lastInsertRowid, sort_order: i, ...item });
|
|
subitems.forEach((sub, j) => insert("content_block_subitems", { item_id: entry.lastInsertRowid, sort_order: j, ...sub }));
|
|
});
|
|
tags.forEach((tag, i) => insert("content_block_tags", { block_id: lastInsertRowid, sort_order: i, ...tag }));
|
|
});
|
|
}
|
|
|
|
function links(ownerKind, ownerId, list) {
|
|
list.forEach((link, order) => insert("links", { owner_kind: ownerKind, owner_id: ownerId, sort_order: order, ...link }));
|
|
}
|
|
|
|
const place = {
|
|
venue: "Showcase Retreat Center",
|
|
address: "123 Example Road",
|
|
locality: "Exampletown",
|
|
state_code: "PA",
|
|
country: "US",
|
|
location_label: "Exampletown, PA",
|
|
latitude: 40.2732,
|
|
longitude: -76.8867,
|
|
};
|
|
|
|
tx(db, () => {
|
|
/* ── Clear the last run ── cleanup triggers take blocks, links,
|
|
timeline entries and featured cards; foreign keys the rest. */
|
|
db.prepare(`DELETE FROM blog_posts WHERE id = ?`).run(POST_ID);
|
|
db.prepare(`DELETE FROM timeline_entries WHERE title LIKE 'Showcase%' OR ref_id LIKE 'showcase-%'`).run();
|
|
db.prepare(`DELETE FROM events WHERE id LIKE 'showcase-%'`).run();
|
|
db.prepare(`DELETE FROM person_awards WHERE award_id LIKE 'showcase-%' OR person_id LIKE 'showcase-%'`).run();
|
|
db.prepare(`DELETE FROM awards WHERE id LIKE 'showcase-%'`).run();
|
|
db.prepare(`DELETE FROM affiliations WHERE person_id LIKE 'showcase-%' OR org_id LIKE 'showcase-%'`).run();
|
|
db.prepare(`DELETE FROM teams WHERE id LIKE 'showcase-%'`).run();
|
|
db.prepare(`DELETE FROM venues WHERE id LIKE 'showcase-%'`).run();
|
|
db.prepare(`DELETE FROM people WHERE id LIKE 'showcase-%'`).run();
|
|
db.prepare(`DELETE FROM organizations WHERE id = ?`).run(GROUP);
|
|
db.prepare(`DELETE FROM organizations WHERE id LIKE 'showcase-%'`).run();
|
|
|
|
/* ── Organizations ── */
|
|
insert("organizations", {
|
|
id: REGION,
|
|
kind: "region",
|
|
name: "Showcase Region",
|
|
short_name: "Showcase",
|
|
tagline: "A region with every field filled in",
|
|
color: "#7a5ea8",
|
|
logo: IMAGE,
|
|
...place,
|
|
is_published: 1,
|
|
is_listed: LISTED,
|
|
sort_order: 99,
|
|
in_timeline: LISTED,
|
|
});
|
|
insert("regions", { id: REGION, scope: "domestic", map_note: "Showcase map note: shares Pennsylvania" });
|
|
insert("region_areas", { region_id: REGION, area_code: "PA", share: 0.5, edge: "top", note: "western half" });
|
|
insert("region_areas", { region_id: REGION, area_code: "OH", share: 1 });
|
|
links("organization", REGION, standardLinks("Showcase Region"));
|
|
blocks("organization", REGION, "both", cardText("region"));
|
|
blocks("organization", REGION, "body", pageBody("region"));
|
|
|
|
insert("organizations", {
|
|
id: GROUP,
|
|
kind: "group",
|
|
name: "Showcase Group",
|
|
short_name: "Showcase Ch.",
|
|
tagline: "A group with every field filled in",
|
|
color: "#138ba0",
|
|
logo: IMAGE,
|
|
...place,
|
|
venue: "Showcase Community Hall",
|
|
is_published: 1,
|
|
is_listed: LISTED,
|
|
sort_order: 99,
|
|
});
|
|
insert("groups", { id: GROUP, region_id: REGION, meets: "2nd Sundays, 6:00pm", started: "Since 2021" });
|
|
["in-person", "online"].forEach((tag_id, i) => insert("organization_tags", { org_id: GROUP, tag_id, sort_order: i }));
|
|
links("organization", GROUP, standardLinks("Showcase Group"));
|
|
blocks("organization", GROUP, "both", cardText("group"));
|
|
blocks("organization", GROUP, "body", pageBody("group"));
|
|
|
|
/* ── People ── */
|
|
insert("people", {
|
|
id: PERSON,
|
|
display_name: "Showcase Person",
|
|
sort_name: "Person, Showcase",
|
|
pronouns: "they/them",
|
|
tagline: "A person with every field filled in",
|
|
photo: IMAGE,
|
|
public_email: "showcase.person@example.org",
|
|
public_phone: "555-0100",
|
|
locality: "Exampletown",
|
|
state_code: "PA",
|
|
country: "US",
|
|
location_label: "Exampletown, PA",
|
|
bio: "Showcase Person is test data. This bio has two paragraphs so the page's spacing can be checked.\n\nThe second paragraph. Everything about this person is made up by seed-showcase.js.",
|
|
primary_org_id: GROUP,
|
|
is_published: 1,
|
|
is_listed: LISTED,
|
|
});
|
|
insert("person_private", {
|
|
person_id: PERSON,
|
|
birth_date: "2000-01-01",
|
|
private_email: "private@example.org",
|
|
private_phone: "555-0199",
|
|
address: "1 Private Lane, Exampletown, PA",
|
|
notes: "Private notes: only the admin shows these.",
|
|
});
|
|
links("person", PERSON, [
|
|
{ kind: "social", platform: "instagram", label: "@showcase.person", url: "https://instagram.com/showcase.person" },
|
|
{ kind: "social", platform: "linkedin", label: "LinkedIn", url: "https://linkedin.com/in/showcase" },
|
|
{ kind: "website", label: "Website", url: "https://example.org/person" },
|
|
{ kind: "action", label: "Book a call", url: "https://example.org/call" },
|
|
]);
|
|
blocks("person", PERSON, "both", cardText("person"));
|
|
blocks("person", PERSON, "body", pageBody("person"));
|
|
|
|
MEMBERS.forEach((id, i) =>
|
|
insert("people", {
|
|
id,
|
|
display_name: `Showcase Member ${i + 1}`,
|
|
sort_name: `Member ${i + 1}, Showcase`,
|
|
pronouns: ["she/her", "he/him", "they/them"][i],
|
|
tagline: "A supporting person for rosters",
|
|
photo: i === 2 ? null : IMAGE, // one without a photo, for the initials fallback
|
|
location_label: "Exampletown, PA",
|
|
primary_org_id: REGION,
|
|
is_published: 1,
|
|
is_listed: LISTED,
|
|
}),
|
|
);
|
|
|
|
/* ── Team, and everyone's roles ── */
|
|
insert("teams", {
|
|
id: TEAM,
|
|
org_id: REGION,
|
|
name: "Showcase Team",
|
|
tagline: "A team with a lead and members",
|
|
color: "#88b668",
|
|
logo: IMAGE,
|
|
is_published: 1,
|
|
is_listed: LISTED,
|
|
sort_order: 99,
|
|
});
|
|
links("team", TEAM, [{ kind: "action", label: "Join the team", url: "https://example.org/join" }]);
|
|
blocks("team", TEAM, "both", cardText("team"));
|
|
blocks("team", TEAM, "body", pageBody("team"));
|
|
|
|
insert("affiliations", { person_id: PERSON, org_id: REGION, team_id: TEAM, title: "Showcase Team Lead", role: "lead", is_owner: 1, started_on: "2023-01-01", is_public: 1, sort_order: 0 });
|
|
insert("affiliations", { person_id: PERSON, org_id: GROUP, title: "Former Group Coordinator", role: "volunteer", started_on: "2021-01-01", ended_on: "2022-12-31", is_public: 1, sort_order: 1 });
|
|
MEMBERS.forEach((id, i) =>
|
|
insert("affiliations", { person_id: id, org_id: REGION, team_id: TEAM, title: ["Treasurer", "Secretary", null][i], role: i === 2 ? "member" : "board", is_public: 1, sort_order: i + 1 }),
|
|
);
|
|
|
|
/* ── Events ── */
|
|
insert("events", {
|
|
id: EVENT,
|
|
scope_id: "regional",
|
|
event_type: "retreat",
|
|
title: "Showcase Retreat",
|
|
theme: "Every Field Filled",
|
|
tagline: "An upcoming event with everything set",
|
|
starts_on: db.prepare(`SELECT date('now', '+45 days') AS d`).get().d,
|
|
ends_on: db.prepare(`SELECT date('now', '+47 days') AS d`).get().d,
|
|
date_label: "Three days, six weeks from now",
|
|
...place,
|
|
org_logo: IMAGE,
|
|
event_logo: IMAGE,
|
|
color: "#d62976",
|
|
card_image: IMAGE,
|
|
photo: IMAGE,
|
|
photo_alt: "The showcase test image",
|
|
is_published: 1,
|
|
is_listed: LISTED,
|
|
in_timeline: LISTED,
|
|
});
|
|
insert("event_hosts", { event_id: EVENT, org_id: REGION, sort_order: 0 });
|
|
insert("event_hosts", { event_id: EVENT, person_id: PERSON, sort_order: 1 });
|
|
[
|
|
[PERSON, "speaker", "Keynote"],
|
|
[MEMBERS[0], "leader", "Worship leader"],
|
|
[MEMBERS[1], "facilitator", "Workshop facilitator"],
|
|
[MEMBERS[2], "musician", null],
|
|
].forEach(([person_id, role, title], i) =>
|
|
insert("event_people", { event_id: EVENT, person_id, role, title, is_public: 1, sort_order: i }),
|
|
);
|
|
links("event", EVENT, [
|
|
{ kind: "action", label: "Register", url: "https://example.org/register", is_primary: 1 },
|
|
{ kind: "action", platform: "discord", label: "Event Discord", url: "https://discord.com/invite/example" },
|
|
{ kind: "social", platform: "instagram", label: "@showcaseretreat", url: "https://instagram.com/showcaseretreat" },
|
|
]);
|
|
blocks("event", EVENT, "both", cardText("event"));
|
|
|
|
insert("events", {
|
|
id: SERIES,
|
|
scope_id: "local",
|
|
event_type: "class",
|
|
title: "Showcase Weekly Class",
|
|
tagline: "A repeating series",
|
|
starts_on: db.prepare(`SELECT date('now', '-14 days') AS d`).get().d,
|
|
ends_on: db.prepare(`SELECT date('now', '+90 days') AS d`).get().d,
|
|
location_label: "Online",
|
|
color: "#138ba0",
|
|
is_series: 1,
|
|
series_frequency: "weekly",
|
|
series_interval: 1,
|
|
series_tue: 1,
|
|
series_thu: 1,
|
|
series_start_time: "19:00",
|
|
series_end_time: "20:30",
|
|
series_count: 24,
|
|
is_published: 1,
|
|
is_listed: LISTED,
|
|
});
|
|
insert("event_hosts", { event_id: SERIES, org_id: GROUP, sort_order: 0 });
|
|
insert("event_tags", { event_id: SERIES, tag_id: "online" });
|
|
links("event", SERIES, [{ kind: "action", label: "Join on Zoom", url: "https://example.org/zoom" }]);
|
|
blocks("event", SERIES, "card", cardText("series"));
|
|
|
|
insert("events", {
|
|
id: PAST,
|
|
scope_id: "regional",
|
|
event_type: "workshop",
|
|
title: "Showcase Past Workshop",
|
|
starts_on: "2025-06-14",
|
|
ends_on: "2025-06-14",
|
|
date_label: "June 14, 2025",
|
|
location_label: "Exampletown, PA",
|
|
color: "#4a6b72",
|
|
is_published: 1,
|
|
is_listed: LISTED,
|
|
});
|
|
// Hosted by the region, shown as its team (054).
|
|
insert("event_hosts", { event_id: PAST, org_id: REGION, team_id: TEAM, sort_order: 0 });
|
|
insert("event_people", { event_id: PAST, person_id: PERSON, role: "host", is_public: 1, sort_order: 0 });
|
|
blocks("event", PAST, "card", cardText("past event"));
|
|
|
|
/* ── Venue (088): a pin, a box and an unmarked location ── */
|
|
insert("venues", { id: VENUE, name: "Showcase Retreat Center", address: "123 Example Road, Exampletown PA", map_image: IMAGE });
|
|
[
|
|
{ location_key: "hall", name: "Main Hall", detail: "Sessions and talent night", x: 30, y: 40 },
|
|
{ location_key: "rooma", name: "Room A", detail: "Workshops", x: 55, y: 20, w: 25, h: 30 },
|
|
{ location_key: "desk", name: "Front desk", detail: "Not marked on the map" },
|
|
].forEach((location, i) => insert("venue_locations", { venue_id: VENUE, sort_order: i, ...location }));
|
|
|
|
// The retreat's page, after the workshop and venue its schedule names.
|
|
blocks("event", EVENT, "body", [
|
|
...pageBody("event"),
|
|
["heading", { text: "Schedule" }],
|
|
SCHEDULE,
|
|
["heading", { text: "Map" }],
|
|
["map", { venue_id: VENUE }],
|
|
]);
|
|
|
|
/* ── Award ── */
|
|
insert("awards", {
|
|
id: AWARD,
|
|
org_id: REGION,
|
|
name: "Showcase Award",
|
|
description: "An award with recipients. One was presented at an event, one wasn't.",
|
|
logo: IMAGE,
|
|
is_published: 1,
|
|
is_listed: LISTED,
|
|
sort_order: 99,
|
|
});
|
|
insert("person_awards", { person_id: PERSON, award_id: AWARD, event_id: PAST, awarded_on: "2025-06-14", citation: "For filling in every field.", is_public: 1 });
|
|
insert("person_awards", { person_id: MEMBERS[0], award_id: AWARD, awarded_on: "2024-05-01", citation: "For showing up.", is_public: 1 });
|
|
|
|
/* ── Timeline, only when listed: the history page shows every
|
|
published entry, so an unlisted showcase would still appear
|
|
there. ── */
|
|
if (LISTED) {
|
|
insert("timeline_entries", { kind: "event", ref_kind: "event", ref_id: EVENT, precision: "day", is_featured: 1, is_published: 1 });
|
|
insert("timeline_entries", { kind: "organization", ref_kind: "organization", ref_id: REGION, occurred_on: "2020-09-01", precision: "month", is_published: 1 });
|
|
insert("timeline_entries", { kind: "award", ref_kind: "award", ref_id: AWARD, occurred_on: "2025-06-14", precision: "day", is_published: 1 });
|
|
const { lastInsertRowid } = insert("timeline_entries", {
|
|
kind: "people",
|
|
ref_kind: "team",
|
|
ref_id: TEAM,
|
|
occurred_on: "2023-01-01",
|
|
precision: "year",
|
|
title: "Showcase Team formed",
|
|
blurb: "A team entry drawn as a roster.",
|
|
meta: "Showcase",
|
|
is_published: 1,
|
|
});
|
|
insert("timeline_entry_people", { entry_id: lastInsertRowid, person_id: PERSON, note: "Founding lead", sort_order: 0 });
|
|
insert("timeline_entries", { kind: "milestone", occurred_on: "2019", precision: "year", title: "Showcase milestone", blurb: "A hand-written entry with no record behind it.", link_url: "/history", is_published: 1 });
|
|
}
|
|
|
|
/* ── Blog post ── */
|
|
insert("blog_posts", {
|
|
id: POST_ID,
|
|
title: "Content block showcase",
|
|
excerpt: "Every block type in one place, for checking the page.",
|
|
cover_image: IMAGE,
|
|
published_on: db.prepare(`SELECT date('now') AS d`).get().d,
|
|
tags: "Test, Showcase",
|
|
show_contents: 1,
|
|
guest_author: "A Guest Author",
|
|
guest_photo: IMAGE,
|
|
is_published: 1,
|
|
is_listed: LISTED,
|
|
});
|
|
insert("blog_post_authors", { post_id: POST_ID, person_id: PERSON, sort_order: 0 });
|
|
blocks("blog_post", POST_ID, "body", ALL_BLOCKS);
|
|
});
|
|
|
|
db.close();
|
|
|
|
console.log(`✓ Showcase written (${LISTED ? "listed" : "unlisted: pages only"}):`);
|
|
for (const path of [
|
|
`/regions/${REGION}`,
|
|
`/groups/${GROUP}`,
|
|
`/teams/${TEAM}`,
|
|
`/awards/${AWARD}`,
|
|
`/people/${PERSON}`,
|
|
`/events/${EVENT}`,
|
|
`/events/${SERIES}`,
|
|
`/events/${PAST}`,
|
|
`/blog/${POST_ID}`,
|
|
]) {
|
|
console.log(` ${path}`);
|
|
}
|