mirror of
https://github.com/Dvorinka/Bookra.git
synced 2026-10-28 15:51:15 +00:00
GET /v1/public/calendar/{token} serves an RFC 5545 calendar under a
token-as-secret URL (private Google/Outlook link model). Staff feeds
contain only that member's bookings; the tenant feed tags each event
with the staff member. Window is -30d to +180d; cancelled bookings map
to STATUS:CANCELLED, waitlisted/pending to TENTATIVE + TRANSPARENT.
Summaries resolve service or class-session titles, descriptions carry
localized contact labels, locations resolve to names.
Feed tokens live on tenants/staff (migration 00015) and are managed via
GET /v1/calendar/feed plus POST /v1/calendar/feed/rotate — rotating a
scope invalidates the old URL. ICS rendering is hand-rolled: TEXT
escaping, CRLF, 75-octet folding on rune boundaries.
Settings gains a "Kalendář (ICS)" card with copyable URLs and two-step
rotation per scope; demo mode points at the real seeded tokens.
Generated with [Devin](https://devin.ai)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
19 lines
830 B
SQL
19 lines
830 B
SQL
-- +goose Up
|
|
-- Read-only ICS calendar feeds: one token per tenant (all bookings) and one
|
|
-- per staff member (their bookings only). The token is the secret — anyone
|
|
-- holding the URL can read the feed, so tokens are rotatable from settings.
|
|
-- Postgres backfills existing rows with random values via the DEFAULT.
|
|
ALTER TABLE tenants
|
|
ADD COLUMN IF NOT EXISTS feed_token text NOT NULL DEFAULT encode(gen_random_bytes(16), 'hex');
|
|
ALTER TABLE tenants
|
|
ADD CONSTRAINT tenants_feed_token_key UNIQUE (feed_token);
|
|
|
|
ALTER TABLE staff
|
|
ADD COLUMN IF NOT EXISTS feed_token text NOT NULL DEFAULT encode(gen_random_bytes(16), 'hex');
|
|
ALTER TABLE staff
|
|
ADD CONSTRAINT staff_feed_token_key UNIQUE (feed_token);
|
|
|
|
-- +goose Down
|
|
ALTER TABLE staff DROP COLUMN IF EXISTS feed_token;
|
|
ALTER TABLE tenants DROP COLUMN IF EXISTS feed_token;
|