Clean up code found in the audit
- Replace every em-dash in src and server/src with a colon, comma or hyphen - Give every relative import its file extension (.jsx imports of .tsx fixed) - Delete old-historyMock.ts, unused exports, unused CSS utilities, the unused @ alias and the fallback option nothing passed - One copy each of initials, capitalize, byName and the server's marks() - Move the organization, chapter and event hooks from src/data to src/lib - Schema sync always throws on a mismatch (strict was never turned off) - Replace the placeholder README Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
4066e9ec61
commit
5274e09571
75 changed files with 282 additions and 688 deletions
|
|
@ -1,5 +1,5 @@
|
|||
/* ═══════════════════════════════════════════════════════════════
|
||||
CONTENT ROUTES — read-only, mounted under /api
|
||||
CONTENT ROUTES: read-only, mounted under /api
|
||||
|
||||
GET /events list + the event scopes
|
||||
GET /events/:id one event, full body, people
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
Organizations are one table, so they're one endpoint. A region
|
||||
and a chapter differ by a handful of fields, which arrive under
|
||||
`details` rather than as separate routes — that's what lets a
|
||||
`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
|
||||
|
|
@ -32,7 +32,7 @@
|
|||
every event.
|
||||
|
||||
An event's hosts are a list, in billing order, and each one is
|
||||
either an organization or a person — `kind` says which, and
|
||||
either an organization or a person, `kind` says which, and
|
||||
`org_kind` is there for the three organization routes. The
|
||||
first is the one the colour and logo fell back to, which is why
|
||||
order is data and not a display choice.
|
||||
|
|
@ -56,6 +56,7 @@ import {
|
|||
asBool,
|
||||
loadBlocks,
|
||||
loadLinks,
|
||||
marks,
|
||||
paragraphs,
|
||||
shapeSeries,
|
||||
splitLinks,
|
||||
|
|
@ -72,7 +73,6 @@ const json = (c, body) => c.json(body, 200, { "Cache-Control": CACHE });
|
|||
|
||||
const ORG_KINDS = ["national", "region", "chapter", "partner"];
|
||||
|
||||
const marks = (n) => Array(n).fill("?").join(",");
|
||||
|
||||
/* ── Loaders ───────────────────────────────────────────────── */
|
||||
|
||||
|
|
@ -83,7 +83,7 @@ const marks = (n) => Array(n).fill("?").join(",");
|
|||
Unpublished hosts are dropped here rather than in the view: the
|
||||
admin reads the same view and needs to see them. An event whose
|
||||
only host is unpublished comes back with an empty list, which is
|
||||
the right answer — there is nobody to name and nowhere to link. */
|
||||
the right answer, there is nobody to name and nowhere to link. */
|
||||
function loadHosts(db, ids) {
|
||||
const byEvent = new Map();
|
||||
if (ids.length === 0) return byEvent;
|
||||
|
|
@ -230,8 +230,8 @@ function shapeTeam(row, links, cardBlocks) {
|
|||
};
|
||||
}
|
||||
|
||||
/* awards.org_id is nullable — an award can predate any decision
|
||||
about which organization owns it — so `org` genuinely can be
|
||||
/* awards.org_id is nullable, an award can predate any decision
|
||||
about which organization owns it, so `org` genuinely can be
|
||||
null, and is also null when the awarding org is unpublished. */
|
||||
function shapeAward(row) {
|
||||
return {
|
||||
|
|
@ -372,7 +372,7 @@ function attachLeadership(db, orgs) {
|
|||
|
||||
/* Every team this organization has, including ones with nobody
|
||||
currently filed under them. `leadership` already carries team_id
|
||||
and team_name, so the page can group people without this — but
|
||||
and team_name, so the page can group people without this, but
|
||||
grouping alone would make an empty team invisible rather than
|
||||
listed, which is the wrong answer for a team that exists. */
|
||||
function attachTeams(db, orgs) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue