Schedule service overview - ita-social-projects/WhatBackend GitHub Wiki

Table of content

  1. General structure
  2. EventOccuranceStorageParser description
  3. Endpoint description
  4. FAQ

General structure

The user provides input for the events to be created automatically on the server and saved in the database.
Input is saved in the event_occurrence table with the occurrence pattern being parsed into BigINT data type by the EventOccuranceStorageParser class.
Outlook input format is used.

Currently, there are 4 types of occurrence patterns available. Each created by a separate ScheduledEventHandler class derived from IScheduledEventHandler. Proper ScheduledEventHandler is created by IScheduledEventHandlerFactory dependency.

  • Daily
  • Weekly
  • AbsoluteMonthly
  • RelativeMonthly

EventOccuranceStorageParser description

There are a limited amount of data set to be stored.

  • the list of weekdays (Monday, Tuesday, Friday, etc.) limited to 7 different options.
  • the list of dates in the month (5, 6, 7, etc) limited to 31 different options.
  • the MonthIndex value representing the number of a week related to a month (First, Second, Last, etc) limited to 5 different options.
  • the Interval value representing how often the event would occur.

Given each unique option could be represented with a bool, any combination above could be stored as a 64-bit integer (given 43 bits for lists with limited capacity and 21 additional to store Interval value).
The GetPatternStorageValue method creates results by successively applying the lists mentioned above. GetFullDataFromStorage could be used to parse data back from the storage.


Endpoint description

  • POST ​/api​/schedules used to create EventOccurrence instance and related ScheduledEvents.
  • GET ​/api​/schedules​/{id} returns EventOccurrence and the list of ScheduledEvents by EventOccurrence ID.
  • POST ​/api​/schedules​/events returns the list of events depending on the filtering rules set. Currently available filtration by "courseID", "mentorID", "groupID", "themeID", "studentAccountID", "eventOccurrenceID", "startDate", "finishDate".
  • PUT ​/api​/schedules​/events​/updateRange allows updating all the events in the filtered selection. Filtering options from POST ​/api​/schedules​/events apply. Scheduled events with confirmed Lessons (not null LessonID field would not get updated).
  • PUT ​/api​/schedules​/events​/{scheduledEventID} allows updating a single ScheduledEvent.
  • PUT /api/schedules/eventOccurrences/{eventOccurrenceID} Old instance of event occurrence is replaced with the new one (id remains the same). Scheduled events are recreated accordingly. Any events with lessons attached are not removed.
  • DELETE ​/api​/schedules​/{eventOccurrenceID} Removes scheduled events related to specified EventOccurrence, updates start and finish dates accordingly. If no events are left, the event occurrence is deleted completely. Events with lessons attached are not removed.

FAQ

please add your questions here