🧭 Overview

  • The worker integrates with up to three Notion databases
  • Database IDs are set as [vars] in wrangler.toml; the API key is a Wrangler secret
  • NOTION_DATABASE_ID is required for live event data; shifts and announcements are optional
  • If NOTION_API_KEY is not configured, /api/events falls 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_KEY

The 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 propertyTypeNotes
NameTitleEvent name
Event StartDateStart date/time (with timezone)
Event EndDateEnd date/time (optional but recommended)
LocationRich text or SelectMust contain the word "pub" (case-insensitive) for the event to appear
Include on Pub TVCheckboxMust be checked for the event to appear on the TV display

Optional properties

Notion propertyTypeNotes
Duration (hrs)NumberUsed to estimate end time if Event End is not set
Source Email SubjectRich textScanned for RC-Direct or RC-Affiliate substrings to tag the event

Location filter

Only events whose Location property contains the substring "pub" (case-insensitive) are included. Events at other venues are silently excluded.

TV include gate

The Include on Pub TV checkbox 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 todayEvents or weekEvents. 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 propertyTypeNotes
Date/TimeDate (with end)Full shift window β€” start and end of the entire shift including setup/cleanup
Not in PubCheckboxIf checked, the shift is excluded from the pub display

Optional properties

Notion propertyTypeNotes
Operational TimeframeDate (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 CallNumberMinutes before the operational end to begin the β€œLast call” state. E.g. 10 triggers last call at 10 min before Operational Timeframe ends
Shift StatusSelect / StatusFree-text status (informational; not used in display logic currently)
Assignments DBRelationLinks 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): within lastCallMinutes of 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 propertyTypeNotes
NameTitleFallback announcement text if Content is empty
Include on Pub TVCheckboxMust be checked for the announcement to be returned by the worker at all

Optional properties

Notion propertyTypeNotes
ContentRich textPreferred 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 Notion Priority field 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.