@myclub_se/data-access 2.9.3 → 2.9.4

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.
@@ -433,7 +433,7 @@ class BookingCalendarSlot {
433
433
  repeat_num: new FormControl(slot?.repeat_num || 6, Validators.max(24)),
434
434
  repeat_to_day: new FormControl(slot?.repeat_to_day || ''),
435
435
  repeat_type: new FormControl(slot?.repeat_type || ''),
436
- update_repeating: new FormControl(typeof slot?.update_repeating !== 'undefined' ? slot?.update_repeating : false),
436
+ update_repeating: new FormControl(!!slot?.update_repeating || false),
437
437
  reserved_time_enabled: new FormControl(typeof slot?.reserved_time_enabled !== 'undefined' ? slot?.reserved_time_enabled : false),
438
438
  reserved_time: new FormControl(slot?.reserved_time || '00:00'),
439
439
  reserved_time_position: new FormControl(slot?.reserved_time_position || ''),
@@ -442,7 +442,7 @@ class BookingCalendarSlot {
442
442
  }
443
443
 
444
444
  class BookingCalendarSlotSession {
445
- constructor(id, section_id, slot_id, team_id, end_time, section_name, start_time, team_name, is_overbooked, type, location_zones_taken, slot_index, comment, location_part_id, location_part_name, location_id, repeat, activity_type_id, color = null) {
445
+ constructor(id, section_id, slot_id, team_id, end_time, section_name, start_time, team_name, is_overbooked, type, location_zones_taken, slot_index, comment, location_part_id, location_part_name, location_id, repeat, activity_type_id, color = null, update_repeating) {
446
446
  this.id = id;
447
447
  this.section_id = section_id;
448
448
  this.slot_id = slot_id;
@@ -462,6 +462,7 @@ class BookingCalendarSlotSession {
462
462
  this.repeat = repeat;
463
463
  this.activity_type_id = activity_type_id;
464
464
  this.color = color;
465
+ this.update_repeating = update_repeating;
465
466
  }
466
467
  static asFormGroup(session) {
467
468
  return new FormGroup({
@@ -480,6 +481,7 @@ class BookingCalendarSlotSession {
480
481
  location_part_id: new FormControl(session?.location_part_id || ''),
481
482
  repeat: new FormControl(session?.repeat || false),
482
483
  activity_type_id: new FormControl(session?.activity_type_id || null),
484
+ update_repeating: new FormControl(!!session?.update_repeating || false),
483
485
  });
484
486
  }
485
487
  }
@@ -1601,7 +1603,7 @@ const bookingCalendarFactory = (apiBookingCalendar) => new BookingCalendar(apiBo
1601
1603
 
1602
1604
  const bookingCalendarApplicationTimeFactory = (apiBookingApplicationTime) => new BookingCalendarApplicationTime(apiBookingApplicationTime.id, apiBookingApplicationTime.section_id, apiBookingApplicationTime.slot_id, apiBookingApplicationTime.team_id, apiBookingApplicationTime.end_time, apiBookingApplicationTime.section_name, apiBookingApplicationTime.start_time, apiBookingApplicationTime.team_name, apiBookingApplicationTime.location_zones_taken, apiBookingApplicationTime.applicant_comment, apiBookingApplicationTime.reviewer_comment, apiBookingApplicationTime.status, apiBookingApplicationTime.location_part_id, apiBookingApplicationTime.location_part_name, apiBookingApplicationTime.location_id, apiBookingApplicationTime.repeat, apiBookingApplicationTime.activity_type_id, apiBookingApplicationTime.color, apiBookingApplicationTime.slot_start_time, apiBookingApplicationTime.slot_end_time, apiBookingApplicationTime.slot_day, apiBookingApplicationTime.slot_number_of_available_sessions, apiBookingApplicationTime.slot_last_repeating_date, apiBookingApplicationTime.created, apiBookingApplicationTime.location_name);
1603
1605
 
1604
- const bookingCalendarSlotSessionFactory = (apiBookingSlotSession) => new BookingCalendarSlotSession(apiBookingSlotSession.id, apiBookingSlotSession.section_id, apiBookingSlotSession.slot_id, apiBookingSlotSession.team_id, apiBookingSlotSession.end_time, apiBookingSlotSession.section_name, apiBookingSlotSession.start_time, apiBookingSlotSession.team_name, apiBookingSlotSession.is_overbooked, apiBookingSlotSession.type, apiBookingSlotSession.location_zones_taken, apiBookingSlotSession.slot_index, apiBookingSlotSession.comment, apiBookingSlotSession.location_part_id, apiBookingSlotSession.location_part_name, apiBookingSlotSession.location_id, apiBookingSlotSession.repeat, apiBookingSlotSession.activity_type_id, apiBookingSlotSession.color);
1606
+ const bookingCalendarSlotSessionFactory = (apiBookingSlotSession) => new BookingCalendarSlotSession(apiBookingSlotSession.id, apiBookingSlotSession.section_id, apiBookingSlotSession.slot_id, apiBookingSlotSession.team_id, apiBookingSlotSession.end_time, apiBookingSlotSession.section_name, apiBookingSlotSession.start_time, apiBookingSlotSession.team_name, apiBookingSlotSession.is_overbooked, apiBookingSlotSession.type, apiBookingSlotSession.location_zones_taken, apiBookingSlotSession.slot_index, apiBookingSlotSession.comment, apiBookingSlotSession.location_part_id, apiBookingSlotSession.location_part_name, apiBookingSlotSession.location_id, apiBookingSlotSession.repeat, apiBookingSlotSession.activity_type_id, apiBookingSlotSession.color, apiBookingSlotSession.update_repeating);
1605
1607
 
1606
1608
  const bookingCalendarSlotFactory = (apiBookingSlot) => new BookingCalendarSlot(apiBookingSlot.id, apiBookingSlot.calendar_id, apiBookingSlot.calendar_status, apiBookingSlot.location_id, apiBookingSlot.color, apiBookingSlot.day, apiBookingSlot.end_time, apiBookingSlot.group_id, apiBookingSlot.location_name, apiBookingSlot.number_of_available_sessions, apiBookingSlot.sessions && apiBookingSlot.sessions.length ? apiBookingSlot.sessions.map((apiBookingSlotSession) => bookingCalendarSlotSessionFactory(apiBookingSlotSession)) : [], apiBookingSlot.open_sessions && apiBookingSlot.open_sessions.length ? apiBookingSlot.open_sessions.map((apiBookingSlotSession) => bookingCalendarSlotSessionFactory(apiBookingSlotSession)) : [], apiBookingSlot.start_time, apiBookingSlot.type, 'none', false, false, 6, format(new Date(), 'yyyy-MM-dd'), 'repeat_until', apiBookingSlot.reserved_time, apiBookingSlot.reserved_time_position, apiBookingSlot.application_times && apiBookingSlot.application_times.length ? apiBookingSlot.application_times.map((apiBookingApplicationTime) => bookingCalendarApplicationTimeFactory(apiBookingApplicationTime)) : [], apiBookingSlot.last_repeating_date);
1607
1609
 
@@ -2498,6 +2500,7 @@ const CLUB_BOOKING_CALENDAR_SLOT_PATH = ':clubId/activities/slots/:id/';
2498
2500
  const CLUB_BOOKING_CALENDAR_REPEATABLE_SLOT_PATH = ':clubId/activities/slots/:id/all/';
2499
2501
  const CLUB_BOOKING_CALENDAR_SLOT_SESSIONS_PATH = ':clubId/activities/sessions/';
2500
2502
  const CLUB_BOOKING_CALENDAR_SLOT_SESSION_PATH = ':clubId/activities/sessions/:id/';
2503
+ const CLUB_BOOKING_CALENDAR_REPEATABLE_SESSION_PATH = ':clubId/activities/sessions/:id/all/';
2501
2504
  const CLUB_BOOKING_SETTINGS_PATH = ':clubId/activities/booking-settings/';
2502
2505
  const CLUB_BOOKING_CALENDAR_APPLICATION_TIME_PATH = ':clubId/activities/application-times/:id/';
2503
2506
  const CLUB_BOOKING_CALENDAR_APPLICATION_TIMES_PATH = ':clubId/activities/application-times/';
@@ -2512,6 +2515,7 @@ const SECTION_BOOKING_CALENDAR_SLOT_PATH = ':sectionId/activities/slots/:id/';
2512
2515
  const SECTION_BOOKING_CALENDAR_REPEATABLE_SLOT_PATH = ':sectionId/activities/slots/:id/all/';
2513
2516
  const SECTION_BOOKING_CALENDAR_SLOT_SESSIONS_PATH = ':sectionId/activities/sessions/';
2514
2517
  const SECTION_BOOKING_CALENDAR_SLOT_SESSION_PATH = ':sectionId/activities/sessions/:id/';
2518
+ const SECTION_BOOKING_CALENDAR_REPEATABLE_SESSION_PATH = ':sectionId/activities/sessions/:id/all/';
2515
2519
  const SECTION_BOOKING_SETTINGS_PATH = ':sectionId/activities/booking-settings/';
2516
2520
  const SECTION_BOOKING_CALENDAR_APPLICATION_TIME_PATH = ':sectionId/activities/application-times/:id/';
2517
2521
  const SECTION_BOOKING_CALENDAR_APPLICATION_TIMES_PATH = ':sectionId/activities/application-times/';
@@ -2852,13 +2856,13 @@ class BookingCalendarService {
2852
2856
  params
2853
2857
  });
2854
2858
  }
2855
- clearBookingCalendarSlots(role, clubOrSectionOrTeamId, currentWeekStartDate, weekRelativeIndexes, onlyDeleteSessions = false, bookingSlotFilter) {
2859
+ clearBookingCalendarSlots(role, clubOrSectionOrTeamId, currentWeekStartDate, weekRelativeIndexes, onlyDeleteSessions = false, shouldDeleteRepeatingSlots = false, bookingSlotFilter) {
2856
2860
  if (role === Role.ClubAdmin) {
2857
- return this.clearClubBookingCalendarSlots(clubOrSectionOrTeamId, currentWeekStartDate, weekRelativeIndexes, onlyDeleteSessions, bookingSlotFilter);
2861
+ return this.clearClubBookingCalendarSlots(clubOrSectionOrTeamId, currentWeekStartDate, weekRelativeIndexes, onlyDeleteSessions, shouldDeleteRepeatingSlots, bookingSlotFilter);
2858
2862
  }
2859
- return this.clearSectionBookingCalendarSlots(clubOrSectionOrTeamId, currentWeekStartDate, weekRelativeIndexes, onlyDeleteSessions, bookingSlotFilter);
2863
+ return this.clearSectionBookingCalendarSlots(clubOrSectionOrTeamId, currentWeekStartDate, weekRelativeIndexes, onlyDeleteSessions, shouldDeleteRepeatingSlots, bookingSlotFilter);
2860
2864
  }
2861
- clearClubBookingCalendarSlots(clubId, currentWeekStartDate, weekRelativeIndexes, onlyDeleteSessions = false, bookingSlotFilter) {
2865
+ clearClubBookingCalendarSlots(clubId, currentWeekStartDate, weekRelativeIndexes, onlyDeleteSessions = false, shouldDeleteRepeatingSlots = false, bookingSlotFilter) {
2862
2866
  const params = bookingSlotFilter.toParams();
2863
2867
  return this.apiService
2864
2868
  .deleteResourceWithBody(Role.ClubAdmin, CLUB_BOOKING_CALENDAR_SLOTS_CLEAR_PATH, { clubId }, {
@@ -2866,11 +2870,12 @@ class BookingCalendarService {
2866
2870
  current_week_start_date: currentWeekStartDate,
2867
2871
  week_relative_indexes: weekRelativeIndexes,
2868
2872
  only_delete_sessions: onlyDeleteSessions,
2873
+ should_delete_repeating_slots: shouldDeleteRepeatingSlots,
2869
2874
  },
2870
2875
  params,
2871
2876
  });
2872
2877
  }
2873
- clearSectionBookingCalendarSlots(sectionId, currentWeekStartDate, weekRelativeIndexes, onlyDeleteSessions = false, bookingSlotFilter) {
2878
+ clearSectionBookingCalendarSlots(sectionId, currentWeekStartDate, weekRelativeIndexes, onlyDeleteSessions = false, shouldDeleteRepeatingSlots = false, bookingSlotFilter) {
2874
2879
  const params = bookingSlotFilter.toParams();
2875
2880
  return this.apiService
2876
2881
  .deleteResourceWithBody(Role.SectionAdmin, SECTION_BOOKING_CALENDAR_SLOTS_CLEAR_PATH, { sectionId }, {
@@ -2878,6 +2883,7 @@ class BookingCalendarService {
2878
2883
  current_week_start_date: currentWeekStartDate,
2879
2884
  week_relative_indexes: weekRelativeIndexes,
2880
2885
  only_delete_sessions: onlyDeleteSessions,
2886
+ should_delete_repeating_slots: shouldDeleteRepeatingSlots,
2881
2887
  },
2882
2888
  params,
2883
2889
  });
@@ -2955,25 +2961,25 @@ class BookingCalendarService {
2955
2961
  id
2956
2962
  });
2957
2963
  }
2958
- deleteBookingCalendarSlotRepeatable(role, clubOrSectionOrTeamId, id) {
2964
+ deleteBookingCalendarSlotRepeatable(role, clubOrSectionOrTeamId, id, deleteUntilDate) {
2959
2965
  if (role === Role.ClubAdmin) {
2960
- return this.deleteClubBookingCalendarSlotRepeatable(clubOrSectionOrTeamId, id);
2966
+ return this.deleteClubBookingCalendarSlotRepeatable(clubOrSectionOrTeamId, id, deleteUntilDate);
2961
2967
  }
2962
- return this.deleteSectionBookingCalendarSlotRepeatable(clubOrSectionOrTeamId, id);
2968
+ return this.deleteSectionBookingCalendarSlotRepeatable(clubOrSectionOrTeamId, id, deleteUntilDate);
2963
2969
  }
2964
- deleteClubBookingCalendarSlotRepeatable(clubId, id) {
2970
+ deleteClubBookingCalendarSlotRepeatable(clubId, id, deleteUntilDate) {
2965
2971
  return this.apiService
2966
- .deleteResource(Role.ClubAdmin, CLUB_BOOKING_CALENDAR_REPEATABLE_SLOT_PATH, {
2972
+ .deleteResourceWithBody(Role.ClubAdmin, CLUB_BOOKING_CALENDAR_REPEATABLE_SLOT_PATH, {
2967
2973
  clubId,
2968
2974
  id
2969
- });
2975
+ }, { body: { delete_until_date: deleteUntilDate } });
2970
2976
  }
2971
- deleteSectionBookingCalendarSlotRepeatable(sectionId, id) {
2977
+ deleteSectionBookingCalendarSlotRepeatable(sectionId, id, deleteUntilDate) {
2972
2978
  return this.apiService
2973
- .deleteResource(Role.SectionAdmin, SECTION_BOOKING_CALENDAR_REPEATABLE_SLOT_PATH, {
2979
+ .deleteResourceWithBody(Role.SectionAdmin, SECTION_BOOKING_CALENDAR_REPEATABLE_SLOT_PATH, {
2974
2980
  sectionId,
2975
2981
  id
2976
- });
2982
+ }, { body: { delete_until_date: deleteUntilDate } });
2977
2983
  }
2978
2984
  // endregion
2979
2985
  // region Booking calendar slot session
@@ -3067,6 +3073,26 @@ class BookingCalendarService {
3067
3073
  id
3068
3074
  });
3069
3075
  }
3076
+ deleteBookingCalendarSlotSessionRepeatable(role, clubOrSectionOrTeamId, id, deleteUntilDate) {
3077
+ if (role === Role.ClubAdmin) {
3078
+ return this.deleteClubBookingCalendarSlotSessionRepeatable(clubOrSectionOrTeamId, id, deleteUntilDate);
3079
+ }
3080
+ return this.deleteSectionBookingCalendarSlotSessionRepeatable(clubOrSectionOrTeamId, id, deleteUntilDate);
3081
+ }
3082
+ deleteClubBookingCalendarSlotSessionRepeatable(clubId, id, deleteUntilDate) {
3083
+ return this.apiService
3084
+ .deleteResourceWithBody(Role.ClubAdmin, CLUB_BOOKING_CALENDAR_REPEATABLE_SESSION_PATH, {
3085
+ clubId,
3086
+ id
3087
+ }, { body: { delete_until_date: deleteUntilDate } });
3088
+ }
3089
+ deleteSectionBookingCalendarSlotSessionRepeatable(sectionId, id, deleteUntilDate) {
3090
+ return this.apiService
3091
+ .deleteResourceWithBody(Role.SectionAdmin, SECTION_BOOKING_CALENDAR_REPEATABLE_SESSION_PATH, {
3092
+ sectionId,
3093
+ id
3094
+ }, { body: { delete_until_date: deleteUntilDate } });
3095
+ }
3070
3096
  // endregion
3071
3097
  // region Booking Setting
3072
3098
  getBookingSettings(role, clubOrSectionOrTeamId) {