Organization cards: list partners, ministries or a hand-picked set (migration 067)
The Partners section's preset gets "Cards: list" (partners by default, ministries, or both) and an optional hand-picked list (page_section_orgs, partners or ministries only, enforced by trigger) that replaces it in its own order. /organizations takes kind=ministry and ids=; the plain list still leaves ministries out. Ministry cards link to their website only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
635dd21083
commit
fd7e1b6fc1
11 changed files with 146 additions and 23 deletions
|
|
@ -37,11 +37,21 @@ sitePages.get("/site-pages/:id", (c) => {
|
|||
|
||||
const rows = db
|
||||
.prepare(
|
||||
`SELECT id, anchor, title, blurb, accent, preset, scope_id, event_type, view, tag_id
|
||||
`SELECT id, anchor, title, blurb, accent, preset, scope_id, event_type, view, tag_id, org_kinds
|
||||
FROM page_sections WHERE page_id = ? ORDER BY sort_order, id`,
|
||||
)
|
||||
.all(id);
|
||||
const blocks = loadBlocks(db, "page_section", rows.map((row) => String(row.id)));
|
||||
const picked = new Map();
|
||||
for (const { section_id, org_id } of db
|
||||
.prepare(
|
||||
`SELECT o.section_id, o.org_id FROM page_section_orgs o
|
||||
JOIN page_sections s ON s.id = o.section_id
|
||||
WHERE s.page_id = ? ORDER BY o.section_id, o.sort_order, o.id`,
|
||||
)
|
||||
.all(id)) {
|
||||
picked.set(section_id, [...(picked.get(section_id) ?? []), org_id]);
|
||||
}
|
||||
|
||||
return json(c, {
|
||||
page: {
|
||||
|
|
@ -49,6 +59,7 @@ sitePages.get("/site-pages/:id", (c) => {
|
|||
sections: rows.map(({ id: sectionId, ...section }) => ({
|
||||
...section,
|
||||
blocks: blocks.get(String(sectionId)) ?? [],
|
||||
org_ids: picked.get(sectionId) ?? [],
|
||||
})),
|
||||
},
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue