π§ Overview
- The worker integrates with up to three Notion databases
- Database IDs are set as
[vars]inwrangler.toml; the API key is a Wrangler secret NOTION_DATABASE_IDis required for live event data; shifts and announcements are optional- If
NOTION_API_KEYis not configured,/api/eventsfalls back to placeholder data instead of live Notion results
Sources: worker.js (CONFIG section), wrangler.toml
π Credentials
# Set once; stored as an encrypted Wrangler secret (never in wrangler.toml)
wrangler secret put NOTION_API_KEYThe integration token must have read access to all three databases.
π
Events Database (NOTION_DATABASE_ID)
Drives both todayEvents and weekEvents in the API response.
Required properties
| Notion property | Type | Notes |
|---|---|---|
Name | Title | Event name |
Event Start | Date | Start date/time (with timezone) |
Event End | Date | End date/time (optional but recommended) |
Location | Rich text or Select | Must contain the word "pub" (case-insensitive) for the event to appear |
Include on Pub TV | Checkbox | Must be checked for the event to appear on the TV display |
Optional properties
| Notion property | Type | Notes |
|---|---|---|
Duration (hrs) | Number | Used to estimate end time if Event End is not set |
Source Email Subject | Rich text | Scanned for RC-Direct or RC-Affiliate substrings to tag the event |
Location filter
Only events whose
Locationproperty contains the substring"pub"(case-insensitive) are included. Events at other venues are silently excluded.
TV include gate
The
Include on Pub TVcheckbox must be checked. This allows events to exist in the database without cluttering the TV display.
Calendar-day split
The worker uses the normal Eastern calendar date when deciding whether an event lands in
todayEventsorweekEvents. Midnight starts the new day. See what-counts-as-today for the exact behavior.
Sources: worker.js (CONFIG β PUB_KEYWORD, PROP_TV_INCLUDE, PROP_SOURCE_EMAIL_SUBJECT)
π Shifts Database (NOTION_SHIFTS_DATABASE_ID)
Drives the pub tender footer and the pub hours grid on the TV display.
Required properties
| Notion property | Type | Notes |
|---|---|---|
Date/Time | Date (with end) | Full shift window β start and end of the entire shift including setup/cleanup |
Not in Pub | Checkbox | If checked, the shift is excluded from the pub display |
Optional properties
| Notion property | Type | Notes |
|---|---|---|
Operational Timeframe | Date (with end) | Narrower window during which the tender is actively serving. If omitted, the full Date/Time range is used for both display and state logic |
Last Call | Number | Minutes before the operational end to begin the βLast callβ state. E.g. 10 triggers last call at 10 min before Operational Timeframe ends |
Shift Status | Select / Status | Free-text status (informational; not used in display logic currently) |
Assignments DB | Relation | Links to assignment pages that in turn link to Pub Tender profile pages |
Shift state logic
Full shift window: ββββββββββββββββββββββββββββββββββββββ€
Operational timeframe: ββββββββββββββββββββββββ€
Last call window: βββββ€
setup active last-call closed (cleanup)
- Setup: within full shift window, before operational start
- Active (
active): within operational timeframe, outside last-call window - Last call (
last-call): withinlastCallMinutesof operational end - Cleaning / closed (
closed): after operational end, still within full shift window
Sources: worker.js (fetchPubTenderFromNotion, deriveShiftNote)
Assignments relation
The Shifts DB links to an Assignments DB via the Assignments DB relation. Each assignment page links to individual Pub Tender profile pages via the Pub Tenders DB relation. The worker follows this chain to resolve tender names and profile URLs.
flowchart LR SHIFT["Shifts DB page"] -- "Assignments DB" --> ASSIGN["Assignment page"] ASSIGN -- "Pub Tenders DB" --> TENDER["Pub Tender profile page"] TENDER -- "Name / Page URL" --> DISPLAY["TV footer display"]
Sources: worker.js (fetchTenderInfoFromAssignment, fetchTenderInfoFromAssignmentPage)
π’ Announcements Database (NOTION_ANNOUNCEMENTS_DATABASE_ID)
Drives the scrolling announcements panel on the TV display.
Required properties
| Notion property | Type | Notes |
|---|---|---|
Name | Title | Fallback announcement text if Content is empty |
Include on Pub TV | Checkbox | Must be checked for the announcement to be returned by the worker at all |
Optional properties
| Notion property | Type | Notes |
|---|---|---|
Content | Rich text | Preferred announcement text source; falls back to Name |
No date filtering
Announcements are not currently filtered by date β all rows in the database appear. Archive or delete stale announcements to keep the display clean.
Priority is not wired yet
The TV client has styling support for
priority: 'high', but the worker currently reads only announcement text and does not map a NotionPriorityfield into the API response.
Sources: worker.js (fetchAnnouncementsFromNotion)
βοΈ wrangler.toml configuration
[vars]
NOTION_DATABASE_ID = "<32-char hex ID from Events DB URL>"
NOTION_SHIFTS_DATABASE_ID = "<32-char hex ID from Shifts DB URL>"
NOTION_ANNOUNCEMENTS_DATABASE_ID = "<32-char hex ID from Announcements DB URL>"Database IDs are the 32-character hex string in the Notion database URL before the ? query string.