Events
Bookings and admission passes for events with a limited number of places.
Covers events: bookable sessions and signed passes that the door scans. The database decides every scan.
better-supabase add eventsexport default defineConfig({ blocks: { events: {} } });add lists events in blocks, writes the modules of every part and wires the client in lib/blocks.ts. Import the manifest from better-supabase/blocks/events when you build the set with createBlocks.
import { eventsBlock } from "better-supabase/blocks/events";Parts
Installing events installs these blocks. Each stays an ordinary block in the config and keeps its own client.
Helpers
sellTicket: Hold and confirm a booking for the slot, then issue a pass for it. No pass is issued when the booking is refused.
await blocks.events.sellTicket({
serviceId,
resourceId,
startsAt,
customer: { name: "Ann", email: "ann@example.com" },
});The helper returns a Result; each step is idempotent, so retrying after a partial failure is safe.
Remove
better-supabase remove events
better-supabase remove events --with-partsThe first command replaces events in blocks with its parts. The second removes the parts too, except any part another block still needs (remove).
Last updated on