Skip to content

[BE-20] Waitlist — queue members for fully-booked workspaces and notify on availability #1353

Description

@yusuftomilola

Overview

When a workspace is fully booked for a requested range, members currently just get a 409. A waitlist converts that dead end into demand capture: join the queue, get notified the moment a cancellation frees the slot.

Proposed Design

New module backend/src/waitlist/. WaitlistEntry: userId, workspaceId, requestedStart, requestedEnd, seatCount, status (WAITING, NOTIFIED, CONVERTED, EXPIRED, CANCELLED), notifiedAt.

Flow:

  1. POST /waitlist — allowed only when the requested range genuinely has insufficient seats (validate against the live availability from [BE-01]).
  2. On booking cancellation/expiry ([BE-08]/[BE-03]) for that workspace: find the oldest WAITING entry whose range now fits → status NOTIFIED, send notification + email with a booking deep link, start a claim window (WAITLIST_CLAIM_HOURS, default 24).
  3. If the member books within the window (detect on booking creation), mark CONVERTED; when the window lapses, a job expires the entry and notifies the next in line.
  4. GET /waitlist/me, DELETE /waitlist/:id (leave queue); admin list per workspace.

Acceptance Criteria

  • Joining a waitlist for an available slot returns 400 with the availability info.
  • A cancellation notifies exactly one (the oldest fitting) waitlist entry.
  • An unclaimed notification passes to the next member after the claim window.
  • Migration included.

Dependencies

Blocked by [BE-01]. Uses the jobs module ([BE-03]) for claim-window expiry.

Notes for Contributors

Emit the existing WebSocket notification plus email. Comment below to be assigned.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions