Skip to content

[GF-BE-07] Extend bookings module to support recurring booking patterns #1082

Description

@yusuftomilola

Problem

Every booking on ManageHub is a one-off. There is no way for a member to set up a recurring booking (e.g. "book this hot desk every Monday for the next month"). Members are forced to manually re-book the same workspace repeatedly, which is a significant UX gap compared to competing platforms like Nexudus and Cobot.

Proposed Solution

Extend the existing bookings module at backend/src/bookings/ without breaking existing functionality.

Changes to booking.entity.ts:

  • Add isRecurring (boolean, default false)
  • Add recurringGroupId (UUID, nullable — links all instances of one recurring series)

New Entity: RecurringRule at backend/src/bookings/entities/recurring-rule.entity.ts

  • id (UUID)
  • frequency (enum: daily | weekly | monthly)
  • interval (integer — e.g. 1 = every week, 2 = every 2 weeks)
  • daysOfWeek (integer array 0–6, for weekly recurrence — e.g. [1, 3] = Monday and Wednesday)
  • endDate (date, nullable)
  • maxOccurrences (integer, nullable)
  • parentBookingId (UUID FK → bookings — the first generated instance)

New Endpoint: POST /bookings/recurring
Accepts the standard CreateBookingDto plus a recurringRule object. The service generates and saves all booking instances up to endDate or maxOccurrences (cap at 52 to prevent abuse). Availability is checked for each instance before saving.

New Endpoint: DELETE /bookings/recurring/:groupId
Cancels all future (not past) bookings that share the given recurringGroupId.

Acceptance Criteria

  • RecurringRule entity created and migration generated
  • POST /bookings/recurring generates all booking instances and saves them with the same recurringGroupId
  • Workspace availability is checked for every generated instance; conflicting dates are skipped and reported in the response
  • Maximum of 52 instances can be generated in one series
  • Cancelling a single booking in a series does not affect the others
  • DELETE /bookings/recurring/:groupId cancels only future instances (where startDate > now)
  • Existing POST /bookings flow is not changed and still works as before

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions