Call local chapters groups, everywhere
The organization kind is 'group', its side table is groups, pages live at /groups/<id> and the Community page's section is #groups. Migration 052 converts existing databases: the kind and the tables whose CHECKs name chapters are rebuilt, the front page count and request category follow, and the site's own /chapters/ and #chapters links in records are rewritten. Request files now go in Requests/Groups on the shared drive. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
175a18976d
commit
38aff34c97
42 changed files with 473 additions and 254 deletions
|
|
@ -15,7 +15,7 @@
|
|||
columns writable columns of the parent row
|
||||
extensions 1:1 side tables, optionally gated on a column
|
||||
value (organizations.kind decides whether a
|
||||
regions or chapters row should exist)
|
||||
regions or groups row should exist)
|
||||
children ordered collections, replaced wholesale on save
|
||||
singleton the one id this entity ever has; the engine
|
||||
refuses create and delete (see front_page)
|
||||
|
|
@ -86,7 +86,7 @@ export const OPTION_QUERIES = {
|
|||
// dropdowns of which four are always wrong. The timeline and the
|
||||
// featured cards both pick from it. `kind` is the discriminator
|
||||
// the client's filterBy matches on; org_kind disambiguates the label,
|
||||
// since a region and a chapter can share a name.
|
||||
// since a region and a group can share a name.
|
||||
record_refs: `
|
||||
SELECT 'event' AS kind, id, title AS label FROM events
|
||||
UNION ALL
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ export const frontPage = {
|
|||
"manual",
|
||||
"years_since",
|
||||
"regions",
|
||||
"chapters",
|
||||
"groups",
|
||||
"partners",
|
||||
"events_held",
|
||||
"retreats_held",
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ export const organizations = {
|
|||
},
|
||||
|
||||
columns: [
|
||||
enumeration("kind", ["national", "region", "chapter", "partner"], {
|
||||
enumeration("kind", ["national", "region", "group", "partner"], {
|
||||
required: true,
|
||||
}),
|
||||
text("name", { required: true }),
|
||||
|
|
@ -58,10 +58,10 @@ export const organizations = {
|
|||
],
|
||||
},
|
||||
{
|
||||
key: "chapter",
|
||||
table: "chapters",
|
||||
key: "group",
|
||||
table: "groups",
|
||||
idColumn: "id",
|
||||
when: { column: "kind", value: "chapter" },
|
||||
when: { column: "kind", value: "group" },
|
||||
columns: [text("region_id"), text("meets"), text("started")],
|
||||
},
|
||||
],
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ async function findOrMakeFolder(path) {
|
|||
const walked = [];
|
||||
for (const name of path.split("/").filter(Boolean)) {
|
||||
// Each level on the way is known too: "Requests" once
|
||||
// "Requests/Chapters" has been found.
|
||||
// "Requests/Groups" has been found.
|
||||
if (walked.length && !folders.has(walked.join("/"))) folders.set(walked.join("/"), Promise.resolve(parent));
|
||||
walked.push(name);
|
||||
const quoted = name.replace(/\\/g, "\\\\").replace(/'/g, "\\'");
|
||||
|
|
|
|||
219
server/src/migrations/052_groups.sql
Normal file
219
server/src/migrations/052_groups.sql
Normal file
|
|
@ -0,0 +1,219 @@
|
|||
-- ═══════════════════════════════════════════════════════════════
|
||||
-- 052 CHAPTERS BECOME GROUPS
|
||||
--
|
||||
-- Local chapters are called groups now, everywhere: the kind value,
|
||||
-- the side table, the front page count, the Request form's type, the
|
||||
-- pages (/groups/<id>, the Community page's #groups section).
|
||||
--
|
||||
-- organizations.kind 'chapter' → 'group' (CHECK changes, so
|
||||
-- the table is rebuilt as 045 did, then
|
||||
-- its indexes and triggers again)
|
||||
-- chapters renamed groups, its index with it
|
||||
-- front_page_stats.source 'chapters' → 'groups' (rebuilt), and
|
||||
-- the seeded "Chapters" label
|
||||
-- feedback.category 'chapter' → 'group' (a column CHECK
|
||||
-- only, so a new column replaces it)
|
||||
-- links in records the site's own /chapters/ and
|
||||
-- #chapters links, in link columns and
|
||||
-- [text](url) formatting
|
||||
--
|
||||
-- Names and prose written in the admin (an organization called
|
||||
-- "Lynnwood Chapter", a post's paragraph) are left as written.
|
||||
-- ═══════════════════════════════════════════════════════════════
|
||||
|
||||
-- ── organizations.kind ─────────────────────────────────────────
|
||||
|
||||
CREATE TABLE organizations_new (
|
||||
id TEXT PRIMARY KEY, -- slug: 'northwest', 'lynnwood'
|
||||
kind TEXT NOT NULL
|
||||
CHECK (kind IN ('national', 'region', 'group', 'partner')),
|
||||
|
||||
name TEXT NOT NULL,
|
||||
short_name TEXT,
|
||||
tagline TEXT, -- one line, for the card
|
||||
color TEXT,
|
||||
logo TEXT, -- an upload's filename
|
||||
|
||||
venue TEXT,
|
||||
address TEXT,
|
||||
locality TEXT,
|
||||
state_code TEXT, -- US only
|
||||
country TEXT NOT NULL DEFAULT 'US',
|
||||
location_label TEXT,
|
||||
latitude REAL,
|
||||
longitude REAL,
|
||||
is_online INTEGER NOT NULL DEFAULT 0 CHECK (is_online IN (0, 1)),
|
||||
|
||||
is_published INTEGER NOT NULL DEFAULT 1 CHECK (is_published IN (0, 1)),
|
||||
sort_order INTEGER NOT NULL DEFAULT 0,
|
||||
created_at TEXT NOT NULL DEFAULT (datetime('now')),
|
||||
updated_at TEXT NOT NULL DEFAULT (datetime('now')),
|
||||
in_timeline INTEGER NOT NULL DEFAULT 0 CHECK (in_timeline IN (0, 1)),
|
||||
is_listed INTEGER NOT NULL DEFAULT 1 CHECK (is_listed IN (0, 1))
|
||||
) STRICT;
|
||||
|
||||
INSERT INTO organizations_new
|
||||
(id, kind, name, short_name, tagline, color, logo,
|
||||
venue, address, locality, state_code, country, location_label,
|
||||
latitude, longitude, is_online,
|
||||
is_published, sort_order, created_at, updated_at, in_timeline, is_listed)
|
||||
SELECT id, CASE kind WHEN 'chapter' THEN 'group' ELSE kind END,
|
||||
name, short_name, tagline, color, logo,
|
||||
venue, address, locality, state_code, country, location_label,
|
||||
latitude, longitude, is_online,
|
||||
is_published, sort_order, created_at, updated_at, in_timeline, is_listed
|
||||
FROM organizations;
|
||||
|
||||
PRAGMA legacy_alter_table = ON;
|
||||
DROP TABLE organizations;
|
||||
ALTER TABLE organizations_new RENAME TO organizations;
|
||||
PRAGMA legacy_alter_table = OFF;
|
||||
|
||||
CREATE INDEX organizations_kind_idx ON organizations (kind, is_published, sort_order);
|
||||
CREATE INDEX organizations_state_idx ON organizations (state_code);
|
||||
|
||||
|
||||
-- ── chapters → groups ──────────────────────────────────────────
|
||||
|
||||
ALTER TABLE chapters RENAME TO groups;
|
||||
DROP INDEX chapters_region_idx;
|
||||
CREATE INDEX groups_region_idx ON groups (region_id);
|
||||
|
||||
|
||||
-- ── front_page_stats.source ────────────────────────────────────
|
||||
|
||||
CREATE TABLE front_page_stats_new (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
page_id TEXT NOT NULL REFERENCES front_page (id) ON DELETE CASCADE,
|
||||
sort_order INTEGER NOT NULL DEFAULT 0,
|
||||
label TEXT NOT NULL,
|
||||
source TEXT NOT NULL DEFAULT 'manual'
|
||||
CHECK (source IN ('manual', 'years_since', 'regions', 'groups',
|
||||
'partners', 'events_held', 'retreats_held',
|
||||
'people', 'awards_given')),
|
||||
value TEXT,
|
||||
suffix TEXT, -- '+', 'k', ' states'
|
||||
note TEXT
|
||||
) STRICT;
|
||||
|
||||
INSERT INTO front_page_stats_new
|
||||
(id, page_id, sort_order, label, source, value, suffix, note)
|
||||
SELECT id, page_id, sort_order,
|
||||
CASE label WHEN 'Chapters' THEN 'Groups' ELSE label END,
|
||||
CASE source WHEN 'chapters' THEN 'groups' ELSE source END,
|
||||
value, suffix, note
|
||||
FROM front_page_stats;
|
||||
|
||||
PRAGMA legacy_alter_table = ON;
|
||||
DROP TABLE front_page_stats;
|
||||
ALTER TABLE front_page_stats_new RENAME TO front_page_stats;
|
||||
PRAGMA legacy_alter_table = OFF;
|
||||
|
||||
|
||||
-- ── feedback.category ──────────────────────────────────────────
|
||||
|
||||
ALTER TABLE feedback ADD COLUMN category_new TEXT
|
||||
CHECK (category_new IN ('blog', 'event', 'group', 'region', 'partner', 'team', 'award', 'person'));
|
||||
UPDATE feedback SET category_new = CASE category WHEN 'chapter' THEN 'group' ELSE category END;
|
||||
ALTER TABLE feedback DROP COLUMN category;
|
||||
ALTER TABLE feedback RENAME COLUMN category_new TO category;
|
||||
|
||||
UPDATE feedback SET section_id = 'groups' WHERE section_id = 'chapters';
|
||||
UPDATE feedback SET page_path = '/groups/' || substr(page_path, 11)
|
||||
WHERE page_path LIKE '/chapters/%';
|
||||
|
||||
|
||||
-- ── Seeded text ────────────────────────────────────────────────
|
||||
|
||||
UPDATE front_page_path_actions SET description = 'Groups and regions across the country.'
|
||||
WHERE description = 'Chapters and regions across the country.';
|
||||
|
||||
UPDATE affiliations SET title = replace(replace(title, 'Chapter', 'Group'), 'chapter', 'group')
|
||||
WHERE title LIKE '%chapter%';
|
||||
|
||||
|
||||
-- ── The site's own links ───────────────────────────────────────
|
||||
-- A link to one of our group pages or the Community page's section:
|
||||
-- '/chapters/<id>', '/community#chapters', or either on our domain.
|
||||
-- Someone else's site with a /chapters/ path is left alone.
|
||||
|
||||
UPDATE links SET url = replace(replace(url, '/chapters/', '/groups/'), '#chapters', '#groups')
|
||||
WHERE url LIKE '/chapters/%' OR url LIKE '%nextgenerationofunity.org/chapters/%'
|
||||
OR url LIKE '%/community#chapters' OR url = '#chapters';
|
||||
|
||||
UPDATE content_block_items SET url = replace(replace(url, '/chapters/', '/groups/'), '#chapters', '#groups')
|
||||
WHERE url LIKE '/chapters/%' OR url LIKE '%nextgenerationofunity.org/chapters/%'
|
||||
OR url LIKE '%/community#chapters' OR url = '#chapters';
|
||||
|
||||
UPDATE content_blocks SET href = replace(replace(href, '/chapters/', '/groups/'), '#chapters', '#groups')
|
||||
WHERE href LIKE '/chapters/%' OR href LIKE '%nextgenerationofunity.org/chapters/%'
|
||||
OR href LIKE '%/community#chapters' OR href = '#chapters';
|
||||
|
||||
UPDATE featured_cards SET url = replace(replace(url, '/chapters/', '/groups/'), '#chapters', '#groups')
|
||||
WHERE url LIKE '/chapters/%' OR url LIKE '%nextgenerationofunity.org/chapters/%'
|
||||
OR url LIKE '%/community#chapters' OR url = '#chapters';
|
||||
|
||||
UPDATE timeline_entries SET link_url = replace(replace(link_url, '/chapters/', '/groups/'), '#chapters', '#groups')
|
||||
WHERE link_url LIKE '/chapters/%' OR link_url LIKE '%nextgenerationofunity.org/chapters/%'
|
||||
OR link_url LIKE '%/community#chapters' OR link_url = '#chapters';
|
||||
|
||||
UPDATE front_page_slides SET link_url = replace(replace(link_url, '/chapters/', '/groups/'), '#chapters', '#groups')
|
||||
WHERE link_url LIKE '/chapters/%' OR link_url LIKE '%nextgenerationofunity.org/chapters/%'
|
||||
OR link_url LIKE '%/community#chapters' OR link_url = '#chapters';
|
||||
|
||||
UPDATE front_page_path_actions SET url = replace(replace(url, '/chapters/', '/groups/'), '#chapters', '#groups')
|
||||
WHERE url LIKE '/chapters/%' OR url LIKE '%nextgenerationofunity.org/chapters/%'
|
||||
OR url LIKE '%/community#chapters' OR url = '#chapters';
|
||||
|
||||
UPDATE front_page SET primary_url = replace(replace(primary_url, '/chapters/', '/groups/'), '#chapters', '#groups')
|
||||
WHERE primary_url LIKE '/chapters/%' OR primary_url LIKE '%nextgenerationofunity.org/chapters/%'
|
||||
OR primary_url LIKE '%/community#chapters' OR primary_url = '#chapters';
|
||||
|
||||
UPDATE front_page SET secondary_url = replace(replace(secondary_url, '/chapters/', '/groups/'), '#chapters', '#groups')
|
||||
WHERE secondary_url LIKE '/chapters/%' OR secondary_url LIKE '%nextgenerationofunity.org/chapters/%'
|
||||
OR secondary_url LIKE '%/community#chapters' OR secondary_url = '#chapters';
|
||||
|
||||
-- [text](url) formatting in block and item text.
|
||||
UPDATE content_blocks
|
||||
SET text = replace(replace(replace(text, '](/chapters/', '](/groups/'),
|
||||
'](/community#chapters)', '](/community#groups)'),
|
||||
'nextgenerationofunity.org/chapters/', 'nextgenerationofunity.org/groups/')
|
||||
WHERE text LIKE '%](/chapters/%' OR text LIKE '%](/community#chapters)%'
|
||||
OR text LIKE '%nextgenerationofunity.org/chapters/%';
|
||||
|
||||
UPDATE content_block_items
|
||||
SET text = replace(replace(replace(text, '](/chapters/', '](/groups/'),
|
||||
'](/community#chapters)', '](/community#groups)'),
|
||||
'nextgenerationofunity.org/chapters/', 'nextgenerationofunity.org/groups/')
|
||||
WHERE text LIKE '%](/chapters/%' OR text LIKE '%](/community#chapters)%'
|
||||
OR text LIKE '%nextgenerationofunity.org/chapters/%';
|
||||
|
||||
|
||||
-- ── Triggers last (see CLAUDE.md, Migrations) ──
|
||||
-- Dropping organizations took its own triggers with it.
|
||||
|
||||
CREATE TRIGGER organizations_cleanup
|
||||
AFTER DELETE ON organizations
|
||||
BEGIN
|
||||
DELETE FROM content_blocks WHERE owner_kind = 'organization' AND owner_id = old.id;
|
||||
DELETE FROM links WHERE owner_kind = 'organization' AND owner_id = old.id;
|
||||
END;
|
||||
|
||||
CREATE TRIGGER timeline_organizations_cleanup
|
||||
AFTER DELETE ON organizations
|
||||
BEGIN
|
||||
DELETE FROM timeline_entries WHERE ref_kind = 'organization' AND ref_id = old.id;
|
||||
END;
|
||||
|
||||
CREATE TRIGGER organizations_featured_cleanup
|
||||
AFTER DELETE ON organizations
|
||||
BEGIN
|
||||
DELETE FROM featured_cards WHERE ref_kind = 'organization' AND ref_id = old.id;
|
||||
END;
|
||||
|
||||
CREATE TRIGGER organizations_touch
|
||||
AFTER UPDATE ON organizations
|
||||
FOR EACH ROW WHEN new.updated_at = old.updated_at
|
||||
BEGIN
|
||||
UPDATE organizations SET updated_at = datetime('now') WHERE id = new.id;
|
||||
END;
|
||||
|
|
@ -169,7 +169,7 @@ function firstParagraph(db, ownerKind, id, slot) {
|
|||
|
||||
/* ── One page ──────────────────────────────────────────────── */
|
||||
|
||||
const ORG_ROUTES = { region: "/regions", chapter: "/chapters", partner: "/partners", national: "/organizations" };
|
||||
const ORG_ROUTES = { region: "/regions", group: "/groups", partner: "/partners", national: "/organizations" };
|
||||
|
||||
function defaults(site, db, pathname) {
|
||||
const home = db.prepare(`SELECT headline, subhead FROM front_page WHERE id = 'home'`).get();
|
||||
|
|
@ -388,7 +388,7 @@ export function metaFor(db, rawPath) {
|
|||
return { ...meta, title: titled(site, page.title), description: plainText(page.description) ?? meta.description };
|
||||
}
|
||||
|
||||
const match = pathname.match(/^\/(events|regions|chapters|partners|organizations|teams|awards|people|blog)\/([^/]+)$/);
|
||||
const match = pathname.match(/^\/(events|regions|groups|partners|organizations|teams|awards|people|blog)\/([^/]+)$/);
|
||||
if (!match) return notFound(meta);
|
||||
|
||||
const [, base, rawId] = match;
|
||||
|
|
@ -404,8 +404,8 @@ export function metaFor(db, rawPath) {
|
|||
return eventMeta(site, db, id, meta);
|
||||
case "regions":
|
||||
return organizationMeta(site, db, id, "region", meta);
|
||||
case "chapters":
|
||||
return organizationMeta(site, db, id, "chapter", meta);
|
||||
case "groups":
|
||||
return organizationMeta(site, db, id, "group", meta);
|
||||
case "partners":
|
||||
return organizationMeta(site, db, id, "partner", meta);
|
||||
case "organizations":
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
GET /events list + the event scopes
|
||||
GET /events/:id one event, full body, people
|
||||
GET /organizations list, ?kind=region|chapter|…
|
||||
GET /organizations list, ?kind=region|group|…
|
||||
GET /organizations/:id one organization's page
|
||||
GET /teams list, ?org=slug
|
||||
GET /teams/:id one team's page
|
||||
|
|
@ -11,13 +11,13 @@
|
|||
GET /awards/:id one award and its recipients
|
||||
|
||||
Organizations are one table, so they're one endpoint. A region
|
||||
and a chapter differ by a handful of fields, which arrive under
|
||||
and a group differ by a handful of fields, which arrive under
|
||||
`details` rather than as separate routes, that's what lets a
|
||||
list component be written once and pointed at any kind.
|
||||
|
||||
The lists leave out unlisted records (is_listed = 0); the
|
||||
detail routes don't, since reaching one by its link is the
|
||||
point. A region's chapters and an organization's events, teams
|
||||
point. A region's groups and an organization's events, teams
|
||||
and awards are lists too. See 027_listed.sql.
|
||||
|
||||
Responses carry their fallbacks already resolved: an event's
|
||||
|
|
@ -70,7 +70,7 @@ const content = new Hono();
|
|||
// anything. stale-while-revalidate keeps the page instant while the
|
||||
// refresh happens behind it.
|
||||
|
||||
const ORG_KINDS = ["national", "region", "chapter", "partner"];
|
||||
const ORG_KINDS = ["national", "region", "group", "partner"];
|
||||
|
||||
/* ── Loaders ───────────────────────────────────────────────── */
|
||||
|
||||
|
|
@ -112,7 +112,7 @@ function shapeHost(row) {
|
|||
kind: row.host_kind, // 'organization' | 'person'
|
||||
id: row.host_id,
|
||||
name: row.host_name,
|
||||
// Which of /regions, /chapters, /partners the slug belongs to.
|
||||
// Which of /regions, /groups, /partners the slug belongs to.
|
||||
// Null for a person, whose route needs no disambiguating.
|
||||
org_kind: row.host_org_kind,
|
||||
};
|
||||
|
|
@ -264,11 +264,11 @@ function attachRegionDetails(db, orgs) {
|
|||
)
|
||||
.all(...ids);
|
||||
|
||||
// A region's chapters, enough of each for a list entry.
|
||||
// A region's groups, enough of each for a list entry.
|
||||
const children = db
|
||||
.prepare(
|
||||
`SELECT c.region_id, o.id, o.name, o.location_label, o.logo
|
||||
FROM chapters c
|
||||
FROM groups c
|
||||
JOIN organizations o ON o.id = c.id AND o.is_published = 1 AND o.is_listed = 1
|
||||
WHERE c.region_id IN (${marks(ids.length)})
|
||||
ORDER BY o.sort_order, o.name`,
|
||||
|
|
@ -309,20 +309,20 @@ function attachRegionDetails(db, orgs) {
|
|||
scope: byId[org.id]?.scope ?? null,
|
||||
map_note: byId[org.id]?.map_note ?? null,
|
||||
areas: areasBy.get(org.id) ?? [],
|
||||
chapters: childrenBy.get(org.id) ?? [],
|
||||
groups: childrenBy.get(org.id) ?? [],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function attachChapterDetails(db, orgs) {
|
||||
const ids = orgs.filter((o) => o.kind === "chapter").map((o) => o.id);
|
||||
function attachGroupDetails(db, orgs) {
|
||||
const ids = orgs.filter((o) => o.kind === "group").map((o) => o.id);
|
||||
if (ids.length === 0) return;
|
||||
|
||||
const rows = db
|
||||
.prepare(
|
||||
`SELECT c.id, c.region_id, c.meets, c.started,
|
||||
r.name AS region_name, r.color AS region_color
|
||||
FROM chapters c
|
||||
FROM groups c
|
||||
LEFT JOIN organizations r ON r.id = c.region_id
|
||||
WHERE c.id IN (${marks(ids.length)})`,
|
||||
)
|
||||
|
|
@ -331,7 +331,7 @@ function attachChapterDetails(db, orgs) {
|
|||
const byId = Object.fromEntries(rows.map((r) => [r.id, r]));
|
||||
|
||||
for (const org of orgs) {
|
||||
if (org.kind !== "chapter") continue;
|
||||
if (org.kind !== "group") continue;
|
||||
const row = byId[org.id] ?? {};
|
||||
org.details = {
|
||||
region_id: row.region_id ?? null,
|
||||
|
|
@ -539,7 +539,7 @@ content.get("/events/:id", (c) => {
|
|||
/* ── Organizations ─────────────────────────────────────────────
|
||||
GET /organizations every published, listed org
|
||||
GET /organizations?kind=region one kind
|
||||
GET /organizations?kind=region,chapter
|
||||
GET /organizations?kind=region,group
|
||||
|
||||
Whatever the kind, the common card fields are in the same
|
||||
places, so a list component reads `name`, `color`, `logo` and
|
||||
|
|
@ -584,13 +584,13 @@ content.get("/organizations", (c) => {
|
|||
);
|
||||
|
||||
attachRegionDetails(db, organizations);
|
||||
attachChapterDetails(db, organizations);
|
||||
attachGroupDetails(db, organizations);
|
||||
attachLeadership(db, organizations);
|
||||
|
||||
return json(c, { organizations });
|
||||
});
|
||||
|
||||
/* One organization's page: region, chapter, partner or NGU. */
|
||||
/* One organization's page: region, group, partner or NGU. */
|
||||
content.get("/organizations/:id", (c) => {
|
||||
const db = c.get("db");
|
||||
const id = c.req.param("id");
|
||||
|
|
@ -607,7 +607,7 @@ content.get("/organizations/:id", (c) => {
|
|||
const one = [organization];
|
||||
|
||||
attachRegionDetails(db, one);
|
||||
attachChapterDetails(db, one);
|
||||
attachGroupDetails(db, one);
|
||||
attachLeadership(db, one);
|
||||
attachTeams(db, one);
|
||||
attachAwards(db, one);
|
||||
|
|
@ -637,8 +637,8 @@ content.get("/organizations/:id", (c) => {
|
|||
GET /teams/:id one team's page
|
||||
|
||||
An unpublished organization hides its teams too, in both
|
||||
routes. Without that join a retired chapter's board stays
|
||||
reachable by URL after the chapter itself has gone.
|
||||
routes. Without that join a retired group's board stays
|
||||
reachable by URL after the group itself has gone.
|
||||
───────────────────────────────────────────────────────────── */
|
||||
|
||||
content.get("/teams", (c) => {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
One flat list per kind, each row just enough to name a record
|
||||
and build its URL: id and name, plus the organization's kind,
|
||||
which decides whether its page is /regions, /chapters or
|
||||
which decides whether its page is /regions, /groups or
|
||||
/partners. The QR code page reads it to offer "any page on the
|
||||
site" without five list requests carrying descriptions, links
|
||||
and blocks it would throw away.
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ feedback.post("/", async (c) => {
|
|||
const email = clean(body.email, LIMITS.email);
|
||||
const message = clean(body.message, LIMITS.message);
|
||||
const pagePath = clean(body.pagePath, LIMITS.pagePath);
|
||||
// The picker holds nav hashes ('#chapters'); the column holds ids.
|
||||
// The picker holds nav hashes ('#groups'); the column holds ids.
|
||||
const sectionId = clean(body.sectionId, LIMITS.sectionId).replace(/^#/, "");
|
||||
const feedbackType = TYPES.includes(body.feedbackType)
|
||||
? body.feedbackType
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
v_timeline has already done the resolution: an entry with no title
|
||||
of its own carries the referenced record's name, an entry with no
|
||||
date carries the event's starts_on, and org_kind rides along
|
||||
because /regions, /chapters and /partners are three routes and only
|
||||
because /regions, /groups and /partners are three routes and only
|
||||
the database knows which a slug is.
|
||||
|
||||
What's left here is shaping, and three things the view can't do:
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ const PAGE_ID = "home";
|
|||
|
||||
const STAT_QUERIES = {
|
||||
regions: `SELECT COUNT(*) AS n FROM organizations WHERE kind = 'region' AND is_published = 1 AND is_listed = 1`,
|
||||
chapters: `SELECT COUNT(*) AS n FROM organizations WHERE kind = 'chapter' AND is_published = 1 AND is_listed = 1`,
|
||||
groups: `SELECT COUNT(*) AS n FROM organizations WHERE kind = 'group' AND is_published = 1 AND is_listed = 1`,
|
||||
partners: `SELECT COUNT(*) AS n FROM organizations WHERE kind = 'partner' AND is_published = 1 AND is_listed = 1`,
|
||||
events_held: `SELECT COUNT(*) AS n FROM v_events
|
||||
WHERE is_published = 1 AND is_listed = 1 AND effective_status = 'past'`,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
REQUEST ROUTE: POST /api/requests
|
||||
|
||||
The Request form (/request): a blog post, an event, or a new or
|
||||
updated chapter, region, partner, team, award or person, with up
|
||||
updated group, region, partner, team, award or person, with up
|
||||
to MAX_FILES attachments. Stored as a feedback row of type
|
||||
'content' (046_content_requests.sql), files in Google Drive.
|
||||
|
||||
|
|
@ -30,7 +30,7 @@ const requests = new Hono();
|
|||
const CATEGORIES = {
|
||||
blog: ["new"],
|
||||
event: ["new", "update"],
|
||||
chapter: ["new", "update"],
|
||||
group: ["new", "update"],
|
||||
region: ["update"],
|
||||
partner: ["new", "update"],
|
||||
team: ["new", "update"],
|
||||
|
|
@ -64,12 +64,12 @@ export function cleanDetails(raw) {
|
|||
}
|
||||
const MIN_MESSAGE = 10;
|
||||
// Where in the shared drive the files go (googleService.js): a
|
||||
// folder per type under Requests, eg. Requests/Chapters.
|
||||
// folder per type under Requests, eg. Requests/Groups.
|
||||
export const DRIVE_FOLDER = "Requests";
|
||||
export const TYPE_FOLDERS = {
|
||||
blog: "Blog Posts",
|
||||
event: "Events",
|
||||
chapter: "Chapters",
|
||||
group: "Groups",
|
||||
region: "Regions",
|
||||
partner: "Partners",
|
||||
team: "Teams",
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
exercises all of it:
|
||||
|
||||
/regions/showcase-region region: areas, map note, links, blocks
|
||||
/chapters/showcase-chapter chapter: meets, started, region
|
||||
/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
|
||||
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
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 chapters,
|
||||
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,
|
||||
|
|
@ -71,7 +71,7 @@ const IMAGE = "/uploads/showcase.jpg";
|
|||
const POST_ID = "content-block-showcase";
|
||||
|
||||
const REGION = "showcase-region";
|
||||
const CHAPTER = "showcase-chapter";
|
||||
const GROUP = "showcase-group";
|
||||
const TEAM = "showcase-team";
|
||||
const AWARD = "showcase-award";
|
||||
const PERSON = "showcase-person";
|
||||
|
|
@ -229,7 +229,7 @@ tx(db, () => {
|
|||
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 people WHERE id LIKE 'showcase-%'`).run();
|
||||
db.prepare(`DELETE FROM organizations WHERE id = ?`).run(CHAPTER);
|
||||
db.prepare(`DELETE FROM organizations WHERE id = ?`).run(GROUP);
|
||||
db.prepare(`DELETE FROM organizations WHERE id LIKE 'showcase-%'`).run();
|
||||
|
||||
/* ── Organizations ── */
|
||||
|
|
@ -256,11 +256,11 @@ tx(db, () => {
|
|||
blocks("organization", REGION, "body", pageBody("region"));
|
||||
|
||||
insert("organizations", {
|
||||
id: CHAPTER,
|
||||
kind: "chapter",
|
||||
name: "Showcase Chapter",
|
||||
id: GROUP,
|
||||
kind: "group",
|
||||
name: "Showcase Group",
|
||||
short_name: "Showcase Ch.",
|
||||
tagline: "A chapter with every field filled in",
|
||||
tagline: "A group with every field filled in",
|
||||
color: "#138ba0",
|
||||
logo: IMAGE,
|
||||
...place,
|
||||
|
|
@ -270,10 +270,10 @@ tx(db, () => {
|
|||
is_listed: LISTED,
|
||||
sort_order: 99,
|
||||
});
|
||||
insert("chapters", { id: CHAPTER, region_id: REGION, meets: "2nd Sundays, 6:00pm", started: "Since 2021" });
|
||||
links("organization", CHAPTER, standardLinks("Showcase Chapter"));
|
||||
blocks("organization", CHAPTER, "card", cardText("chapter"));
|
||||
blocks("organization", CHAPTER, "body", pageBody("chapter"));
|
||||
insert("groups", { id: GROUP, region_id: REGION, meets: "2nd Sundays, 6:00pm", started: "Since 2021" });
|
||||
links("organization", GROUP, standardLinks("Showcase Group"));
|
||||
blocks("organization", GROUP, "card", cardText("group"));
|
||||
blocks("organization", GROUP, "body", pageBody("group"));
|
||||
|
||||
/* ── People ── */
|
||||
insert("people", {
|
||||
|
|
@ -290,7 +290,7 @@ tx(db, () => {
|
|||
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: CHAPTER,
|
||||
primary_org_id: GROUP,
|
||||
is_published: 1,
|
||||
is_listed: LISTED,
|
||||
});
|
||||
|
|
@ -343,7 +343,7 @@ tx(db, () => {
|
|||
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: CHAPTER, title: "Former Chapter Coordinator", role: "volunteer", started_on: "2021-01-01", ended_on: "2022-12-31", is_public: 1, sort_order: 1 });
|
||||
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 }),
|
||||
);
|
||||
|
|
@ -409,7 +409,7 @@ tx(db, () => {
|
|||
is_published: 1,
|
||||
is_listed: LISTED,
|
||||
});
|
||||
insert("event_hosts", { event_id: SERIES, org_id: CHAPTER, sort_order: 0 });
|
||||
insert("event_hosts", { event_id: SERIES, org_id: GROUP, sort_order: 0 });
|
||||
links("event", SERIES, [{ kind: "action", label: "Join on Zoom", url: "https://example.org/zoom" }]);
|
||||
blocks("event", SERIES, "card", cardText("series"));
|
||||
|
||||
|
|
@ -489,7 +489,7 @@ db.close();
|
|||
console.log(`✓ Showcase written (${LISTED ? "listed" : "unlisted: pages only"}):`);
|
||||
for (const path of [
|
||||
`/regions/${REGION}`,
|
||||
`/chapters/${CHAPTER}`,
|
||||
`/groups/${GROUP}`,
|
||||
`/teams/${TEAM}`,
|
||||
`/awards/${AWARD}`,
|
||||
`/people/${PERSON}`,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue