@myclub_se/data-access 2.5.8 → 2.5.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1916,6 +1916,7 @@ const CLUB_BOOKING_CALENDAR_SLOTS_PATH = ':clubId/activities/slots/';
1916
1916
  const CLUB_BOOKING_CALENDAR_SLOTS_APPLICATION_TIMES_PATH = ':clubId/activities/slots/application-times/';
1917
1917
  const CLUB_BOOKING_CALENDAR_SLOTS_COPY_PATH = ':clubId/activities/slots/copy/';
1918
1918
  const CLUB_BOOKING_CALENDAR_SLOTS_CLEAR_PATH = ':clubId/activities/slots/clear/';
1919
+ const CLUB_BOOKING_CALENDAR_SLOTS_SYNC_PATH = ':clubId/activities/slots/sync/';
1919
1920
  const CLUB_BOOKING_CALENDAR_SLOT_PATH = ':clubId/activities/slots/:id/';
1920
1921
  const CLUB_BOOKING_CALENDAR_REPEATABLE_SLOT_PATH = ':clubId/activities/slots/:id/all/';
1921
1922
  const CLUB_BOOKING_CALENDAR_SLOT_SESSIONS_PATH = ':clubId/activities/sessions/';
@@ -1924,6 +1925,7 @@ const CLUB_BOOKING_SETTINGS_PATH = ':clubId/activities/booking-settings/';
1924
1925
  const CLUB_BOOKING_CALENDAR_APPLICATION_TIME_PATH = ':clubId/activities/application-times/:id/';
1925
1926
  const TEAM_BOOKING_CALENDARS_PATH = ':teamId/activities/calendars/';
1926
1927
  const TEAM_BOOKING_CALENDAR_SLOTS_PATH = ':teamId/activities/slots/';
1928
+ const TEAM_BOOKING_CALENDAR_SLOTS_SYNC_PATH = ':teamId/activities/slots/sync/';
1927
1929
  const TEAM_BOOKING_CALENDAR_SLOTS_APPLICATION_TIMES_PATH = ':teamId/activities/slots/application-times/';
1928
1930
  const TEAM_BOOKING_SETTINGS_PATH = ':teamId/activities/booking-settings/';
1929
1931
  const TEAM_BOOKING_CALENDAR_SLOT_SESSIONS_PATH = ':teamId/activities/sessions/';
@@ -2165,6 +2167,58 @@ class BookingCalendarService {
2165
2167
  params,
2166
2168
  });
2167
2169
  }
2170
+ syncBookingCalendarSlots(role, clubOrTeamId, currentWeekStartDate, weekRelativeIndexes, startDate = null, endDate = null, calendarIds = null, locationIds = null, teamIds = null) {
2171
+ if (role == Role.ClubAdmin) {
2172
+ return this.syncClubBookingCalendarSlots(clubOrTeamId, currentWeekStartDate, weekRelativeIndexes, startDate, endDate, calendarIds, locationIds, teamIds);
2173
+ }
2174
+ return this.syncTeamBookingCalendarSlots(clubOrTeamId, currentWeekStartDate, weekRelativeIndexes, startDate, endDate, calendarIds, locationIds, teamIds);
2175
+ }
2176
+ syncClubBookingCalendarSlots(clubId, currentWeekStartDate, weekRelativeIndexes, startDate = null, endDate = null, calendarIds = null, locationIds = null, teamIds = null) {
2177
+ const params = { limit: 'null' };
2178
+ if (startDate) {
2179
+ params['day__gte'] = startDate;
2180
+ }
2181
+ if (endDate) {
2182
+ params['day__lte'] = endDate;
2183
+ }
2184
+ if (calendarIds && calendarIds.length) {
2185
+ params['calendar_id'] = calendarIds.join(',');
2186
+ }
2187
+ if (locationIds && locationIds.length) {
2188
+ params['location_id'] = locationIds.join(',');
2189
+ }
2190
+ if (teamIds && teamIds.length) {
2191
+ params['team_id'] = teamIds.join(',');
2192
+ }
2193
+ return this.apiService
2194
+ .postResourceNoResponse(Role.ClubAdmin, CLUB_BOOKING_CALENDAR_SLOTS_SYNC_PATH, { clubId }, {
2195
+ current_week_start_date: currentWeekStartDate,
2196
+ week_relative_indexes: weekRelativeIndexes,
2197
+ }, { params });
2198
+ }
2199
+ syncTeamBookingCalendarSlots(teamId, currentWeekStartDate, weekRelativeIndexes, startDate = null, endDate = null, calendarIds = null, locationIds = null, teamIds = null) {
2200
+ const params = { limit: 'null' };
2201
+ if (startDate) {
2202
+ params['day__gte'] = startDate;
2203
+ }
2204
+ if (endDate) {
2205
+ params['day__lte'] = endDate;
2206
+ }
2207
+ if (calendarIds && calendarIds.length) {
2208
+ params['calendar_id'] = calendarIds.join(',');
2209
+ }
2210
+ if (locationIds && locationIds.length) {
2211
+ params['location_id'] = locationIds.join(',');
2212
+ }
2213
+ if (teamIds && teamIds.length) {
2214
+ params['team_id'] = teamIds.join(',');
2215
+ }
2216
+ return this.apiService
2217
+ .postResourceNoResponse(Role.TeamAdmin, TEAM_BOOKING_CALENDAR_SLOTS_SYNC_PATH, { teamId }, {
2218
+ current_week_start_date: currentWeekStartDate,
2219
+ week_relative_indexes: weekRelativeIndexes,
2220
+ }, { params });
2221
+ }
2168
2222
  getClubBookingCalendarSlot(clubId, id) {
2169
2223
  return this.apiService
2170
2224
  .getResource(bookingCalendarSlotFactory, Role.ClubAdmin, CLUB_BOOKING_CALENDAR_SLOT_PATH, { clubId, id });