Add a Listed flag: published records reachable only by their link
is_listed (migration 027) sits beside is_published on organizations, events, people, teams and awards. Unticked, the record's own page still works, but the site's lists leave it out: the list routes, a region's chapters, an organization's events, teams and awards, the QR page's directory, and the front page's counts and countdown. Places where someone attached it by hand (rosters, hosts, billed people, recipients, timeline, a pinned countdown) still show it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
3c02eb8971
commit
cd393e4ab2
7 changed files with 120 additions and 38 deletions
|
|
@ -15,6 +15,11 @@
|
|||
`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
|
||||
and awards are lists too. See 027_listed.sql.
|
||||
|
||||
Responses carry their fallbacks already resolved: an event's
|
||||
`color` is its own or its first host's, and `status` is derived
|
||||
from the dates when it isn't set. Components read one field and
|
||||
|
|
@ -266,7 +271,7 @@ function attachRegionDetails(db, orgs) {
|
|||
.prepare(
|
||||
`SELECT c.region_id, o.id, o.name, o.location_label, o.logo
|
||||
FROM chapters c
|
||||
JOIN organizations o ON o.id = c.id AND o.is_published = 1
|
||||
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`,
|
||||
)
|
||||
|
|
@ -377,7 +382,7 @@ function attachTeams(db, orgs) {
|
|||
.prepare(
|
||||
`SELECT id, org_id, name, tagline, color, logo
|
||||
FROM teams
|
||||
WHERE org_id IN (${marks(ids.length)}) AND is_published = 1
|
||||
WHERE org_id IN (${marks(ids.length)}) AND is_published = 1 AND is_listed = 1
|
||||
ORDER BY sort_order, name`,
|
||||
)
|
||||
.all(...ids);
|
||||
|
|
@ -412,7 +417,7 @@ function attachAwards(db, orgs) {
|
|||
JOIN people p ON p.id = pa.person_id AND p.is_published = 1
|
||||
WHERE pa.award_id = a.id AND pa.is_public = 1) AS recipient_count
|
||||
FROM awards a
|
||||
WHERE a.org_id IN (${marks(ids.length)}) AND a.is_published = 1
|
||||
WHERE a.org_id IN (${marks(ids.length)}) AND a.is_published = 1 AND a.is_listed = 1
|
||||
ORDER BY a.sort_order, a.name`,
|
||||
)
|
||||
.all(...ids);
|
||||
|
|
@ -457,7 +462,7 @@ content.get("/events", (c) => {
|
|||
const rows = db
|
||||
.prepare(
|
||||
`SELECT * FROM v_events
|
||||
WHERE is_published = 1
|
||||
WHERE is_published = 1 AND is_listed = 1
|
||||
ORDER BY ${EVENT_ORDER}`,
|
||||
)
|
||||
.all();
|
||||
|
|
@ -538,7 +543,7 @@ content.get("/events/:id", (c) => {
|
|||
|
||||
|
||||
/* ── Organizations ─────────────────────────────────────────────
|
||||
GET /organizations every published org
|
||||
GET /organizations every published, listed org
|
||||
GET /organizations?kind=region one kind
|
||||
GET /organizations?kind=region,chapter
|
||||
|
||||
|
|
@ -565,7 +570,7 @@ content.get("/organizations", (c) => {
|
|||
const rows = db
|
||||
.prepare(
|
||||
`SELECT * FROM organizations
|
||||
WHERE is_published = 1 ${filter}
|
||||
WHERE is_published = 1 AND is_listed = 1 ${filter}
|
||||
ORDER BY kind, sort_order, name`,
|
||||
)
|
||||
.all(...kinds);
|
||||
|
|
@ -627,7 +632,7 @@ content.get("/organizations/:id", (c) => {
|
|||
e.effective_color AS color
|
||||
FROM v_events e
|
||||
JOIN event_hosts eh ON eh.event_id = e.id AND eh.org_id = ?
|
||||
WHERE e.is_published = 1
|
||||
WHERE e.is_published = 1 AND e.is_listed = 1
|
||||
ORDER BY ${EVENT_ORDER}`,
|
||||
)
|
||||
.all(id);
|
||||
|
|
@ -637,7 +642,7 @@ content.get("/organizations/:id", (c) => {
|
|||
|
||||
|
||||
/* ── Teams ─────────────────────────────────────────────────────
|
||||
GET /teams every published team
|
||||
GET /teams every published, listed team
|
||||
GET /teams?org=mid-atlantic one organization's teams
|
||||
GET /teams/:id one team's page
|
||||
|
||||
|
|
@ -655,7 +660,7 @@ content.get("/teams", (c) => {
|
|||
`SELECT t.*, o.name AS org_name, o.kind AS org_kind
|
||||
FROM teams t
|
||||
JOIN organizations o ON o.id = t.org_id AND o.is_published = 1
|
||||
WHERE t.is_published = 1 ${org ? "AND t.org_id = ?" : ""}
|
||||
WHERE t.is_published = 1 AND t.is_listed = 1 ${org ? "AND t.org_id = ?" : ""}
|
||||
ORDER BY o.sort_order, t.sort_order, t.name`,
|
||||
)
|
||||
.all(...(org ? [org] : []));
|
||||
|
|
@ -720,7 +725,7 @@ content.get("/awards", (c) => {
|
|||
WHERE pa.award_id = a.id AND pa.is_public = 1) AS recipient_count
|
||||
FROM awards a
|
||||
LEFT JOIN organizations o ON o.id = a.org_id AND o.is_published = 1
|
||||
WHERE a.is_published = 1 ${org ? "AND a.org_id = ?" : ""}
|
||||
WHERE a.is_published = 1 AND a.is_listed = 1 ${org ? "AND a.org_id = ?" : ""}
|
||||
ORDER BY a.sort_order, a.name`,
|
||||
)
|
||||
.all(...(org ? [org] : []));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue