People directories, ministries, organization contacts (migrations 062 to 064)

- People tags (062): Data → People tags (Musicians seeded); a person's
  Directories repeater tags them and their Specialty line shows on
  their tile. A People directory section preset shows a tag's first
  12 and links to its full page, /directory/<tag>, with page meta and
  a sitemap entry. Tiles' details panels show a person's links.
- Ministries (063): a new organization kind. A group picks its
  ministry and its page says "Ministry: <name>", linked to the
  ministry's website. Ministries have no public page, list, sitemap
  or timeline entry, and aren't offered where a record links to its
  organization. organizations is rebuilt for the kind CHECK.
- Organization contacts (064): Data → Contact types; a private
  Contacts repeater on each organization (editors and up, readRole on
  a child collection). Tools → Newsletter → Recipients filters them
  by type, kind, region and published and downloads a Mailchimp CSV.
- A trigger refusing a save with a sentence is shown as that message.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-10-03 22:57:34 -05:00
parent 07e56bfd20
commit 0ed7315156
38 changed files with 1108 additions and 29 deletions

View file

@ -4,6 +4,9 @@
GET /teams/:id/people current public members of a team
GET /people?ids=a,b,c named people, any order
GET /people/:id one person's page
GET /directories/:tag a tag's directory: its name and
intro, and its published, listed
people with their specialty and links
The team route reads v_org_leadership, which already decides who
counts as current and public, affiliation still open, marked
@ -21,7 +24,7 @@
import { Hono } from "hono";
import { asBool, json, loadOwned, marks, paragraphs, splitLinks } from "../shape.js";
import { asBool, json, loadLinks, loadOwned, marks, paragraphs, splitLinks } from "../shape.js";
import { postsBy } from "./blog.js";
const people = new Hono();
@ -136,6 +139,54 @@ people.get("/people", (c) => {
return json(c, { people: rows.map(shapePerson) });
});
/* ── A tag's directory ─────────────────────────────────────────
Everyone carrying the tag (062_people_tags.sql), in name order,
each as a tile wants them plus their specialty line and links
(website, music, booking email). Unlisted people stay off it, as
they stay off every list.
───────────────────────────────────────────────────────────── */
people.get("/directories/:tag", (c) => {
const db = c.get("db");
const tag = db
.prepare(`SELECT id, name, blurb FROM person_tag_types WHERE id = ?`)
.get(c.req.param("tag"));
if (!tag) return c.json({ error: "No such directory." }, 404);
const rows = db
.prepare(
`SELECT p.id,
p.display_name,
p.pronouns,
p.photo,
p.tagline,
p.specialty,
p.location_label,
p.public_email,
p.bio,
o.id AS primary_org_id,
o.name AS primary_org_name
FROM person_tags t
JOIN people p ON p.id = t.person_id AND p.is_published = 1 AND p.is_listed = 1
LEFT JOIN organizations o ON o.id = p.primary_org_id AND o.is_published = 1
WHERE t.tag_id = ?
ORDER BY COALESCE(p.sort_name, p.display_name)`,
)
.all(tag.id);
const links = loadLinks(db, "person", rows.map((row) => row.id));
return json(c, {
directory: {
...tag,
people: rows.map((row) => ({
...shapePerson(row),
specialty: row.specialty,
links: links.get(row.id) ?? [],
})),
},
});
});
/* ── One person's page ─────────────────────────────────────────
Everything public that points at this person, each list with
the same visibility rules its own page applies: a role needs a