A region owns featured cards like the front page does, set in its editor (shown when Kind is region). They show in its row of the region list when opened, and in a Featured section on its page. featured_cards takes an 'organization' owner kind; the table is rebuilt, and a region's cards go when it does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
106 lines
2.8 KiB
JavaScript
106 lines
2.8 KiB
JavaScript
import { text, int, real, bool, enumeration, placeColumns, timelineExtension, linksChild, blocksChild, featuredCardsChild } from "./columns.js";
|
|
import { tagsChild } from "./tags.js";
|
|
|
|
/* ── Organizations ───────────────────────────────────────────── */
|
|
|
|
export const organizations = {
|
|
key: "organizations",
|
|
table: "organizations",
|
|
idColumn: "id",
|
|
idKind: "slug",
|
|
concurrency: "updated_at",
|
|
|
|
list: {
|
|
columns: [
|
|
"id",
|
|
"kind",
|
|
"name",
|
|
"short_name",
|
|
"locality",
|
|
"state_code",
|
|
"is_published",
|
|
"is_listed",
|
|
"sort_order",
|
|
"updated_at",
|
|
],
|
|
filters: ["kind", "is_published", "is_listed"],
|
|
search: ["name", "id", "locality"],
|
|
order: "kind, sort_order, name",
|
|
},
|
|
|
|
columns: [
|
|
enumeration("kind", ["national", "region", "group", "partner", "ministry"], {
|
|
required: true,
|
|
}),
|
|
text("name", { required: true }),
|
|
text("short_name"),
|
|
text("tagline"),
|
|
text("color"),
|
|
text("logo"),
|
|
...placeColumns,
|
|
bool("is_published"),
|
|
bool("is_listed"),
|
|
int("sort_order"),
|
|
bool("in_timeline"),
|
|
],
|
|
|
|
extensions: [
|
|
timelineExtension("organization"),
|
|
{
|
|
key: "region",
|
|
table: "regions",
|
|
idColumn: "id",
|
|
when: { column: "kind", value: "region" },
|
|
columns: [
|
|
enumeration("scope", ["domestic", "international", "virtual"], {
|
|
required: true,
|
|
}),
|
|
text("map_note"),
|
|
],
|
|
},
|
|
{
|
|
key: "group",
|
|
table: "groups",
|
|
idColumn: "id",
|
|
when: { column: "kind", value: "group" },
|
|
columns: [text("region_id"), text("ministry_id"), text("meets"), text("started")],
|
|
},
|
|
],
|
|
|
|
children: [
|
|
tagsChild("organization_tags", "org_id"),
|
|
linksChild("organization"),
|
|
blocksChild("organization"),
|
|
// Who to write to there, by role (064_org_contacts.sql): private,
|
|
// for the Newsletter's recipient export.
|
|
{
|
|
key: "contacts",
|
|
table: "organization_contacts",
|
|
owner: { column: "org_id" },
|
|
order: "sort_order",
|
|
readRole: "editor",
|
|
columns: [
|
|
text("type_id", { required: true }),
|
|
text("name"),
|
|
text("email"),
|
|
text("phone"),
|
|
],
|
|
},
|
|
// A region's own featured cards (072), in its row of the region
|
|
// list and on its page.
|
|
{ ...featuredCardsChild("organization"), when: { column: "kind", value: "region" } },
|
|
{
|
|
key: "region_areas",
|
|
table: "region_areas",
|
|
owner: { column: "region_id" },
|
|
when: { column: "kind", value: "region" },
|
|
order: "area_code",
|
|
columns: [
|
|
text("area_code", { required: true }),
|
|
real("share"),
|
|
enumeration("edge", ["top", "bottom"]),
|
|
text("note"),
|
|
],
|
|
},
|
|
],
|
|
};
|