|
|
368ce3ac8c
|
feat(db): dispatches + member-number allocation + focus-tags parser
db.ts:
- User type gains pull_quote, member_number, focus_tags; all SELECT lists
updated. getAllCabMembers (member_number asc) and countCabMembers (used
by /pulse denominator) added.
- createUser allocates a member_number in-transaction when role=cab.
- updateUserRole returns { allocated: number | null } so admin can surface
the assignment; allocation is one-way: pilot→cab→pilot→cab keeps the
original number.
- allocateMemberNumber: MAX(member_number)+1, idempotent, never reuses.
- updateUserAdminFields: title / pull_quote / focus_tags (parsed array).
- createEvent / updateEvent extended for audience, duration_label,
action_label, notes_url.
- Dispatch CRUD: create / update / publish (stamps published_at) /
archive / delete. getDispatchById, getLatestPublishedDispatches,
getAllDispatchesForAdmin, getAdjacentDispatches (prev/next in published
order).
- getEventAttendees(slug, status) backs the upcoming-event avatar pile.
format.ts:
- AVATAR_PIGMENTS (terracotta/copper/walnut/indigo/heather) + pigmentForId
(id % palette, deterministic).
- parseFocusTags: trim, strip ASCII control chars (\x00-\x1F\x7F),
collapse internal whitespace, dedupe, cap 3 × 24.
- readFocusTags (safe JSON.parse for display).
- dispatchSlug / parseDispatchSlug: {id}-{kebab(title)}; renames don't
break links because the id leads.
- dispatchKindLabel, stripMarkdownLight, dispatchExcerptParas (two-paragraph
excerpt with sentence-boundary cut).
Tests: member-number allocation (idempotent, never reuses, allocates on
role transition) and focus_tags parser (control chars, whitespace collapse,
dedupe, cap). 24/24 passing.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-11 15:55:35 +02:00 |
|