Skip to main content

talawa-api / Exports / helpers/event/updateEventHelpers/updateRecurringEventInstances

Module: helpers/event/updateEventHelpers/updateRecurringEventInstances

Table of contents

Functions

Functions

updateRecurringEventInstances

updateRecurringEventInstances(args, event, recurrenceRule, baseRecurringEvent, recurringEventUpdateType, session): Promise<InterfaceEvent>

This function updates this and the following instances of a recurring event.

Parameters

NameTypeDescription
argsMutationUpdateEventArgsupdate event args.
eventInterfaceEventthe event to be updated.
recurrenceRuleInterfaceRecurrenceRulethe recurrence rule followed by the instances.
baseRecurringEventInterfaceEventthe base recurring event.
recurringEventUpdateTypeRecurringEventMutationType-
sessionClientSession-

Returns

Promise<InterfaceEvent>

The updated first instance following the recurrence rule.

Remarks

The following steps are followed:

  1. Check if the recurrence rule has changed.
  2. If the recurrence rule has changed:
    • get the appropriate data to create new recurring event instances and update the baseRecurringEvent.
    • get the recurrence dates and generate new instances.
    • remove the current instances and their associations as a new series has been created. If the recurrence rule hasn't changed:
    • just perform a regular bulk update.
  3. Update the base recurring event if required.
  4. Removes any dangling recurrence rule and base recurrence rule documents.

Defined in

src/helpers/event/updateEventHelpers/updateRecurringEventInstances.ts:45