@myclub_se/data-access 2.9.3 → 2.9.5

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.
@@ -306,7 +306,7 @@ class Authentication {
306
306
  }
307
307
 
308
308
  class BookingCalendar {
309
- constructor(id, club_id, section_id, team_id, club_name, name, section_name, team_name, status, max_application_number, location_groups) {
309
+ constructor(id, club_id, section_id, team_id, club_name, name, section_name, team_name, status, max_application_number, can_team_export, location_groups) {
310
310
  this.id = id;
311
311
  this.club_id = club_id;
312
312
  this.section_id = section_id;
@@ -317,6 +317,7 @@ class BookingCalendar {
317
317
  this.team_name = team_name;
318
318
  this.status = status;
319
319
  this.max_application_number = max_application_number;
320
+ this.can_team_export = can_team_export;
320
321
  this.location_groups = location_groups;
321
322
  }
322
323
  static asFormGroup(calendar) {
@@ -338,6 +339,7 @@ class BookingCalendar {
338
339
  status: new FormControl(calendar?.status || 'preliminary'),
339
340
  location_groups: new FormArray(locationGroups),
340
341
  max_application_number: new FormControl(calendar?.max_application_number || 0),
342
+ can_team_export: new FormControl(calendar?.can_team_export || false)
341
343
  });
342
344
  }
343
345
  }
@@ -433,7 +435,7 @@ class BookingCalendarSlot {
433
435
  repeat_num: new FormControl(slot?.repeat_num || 6, Validators.max(24)),
434
436
  repeat_to_day: new FormControl(slot?.repeat_to_day || ''),
435
437
  repeat_type: new FormControl(slot?.repeat_type || ''),
436
- update_repeating: new FormControl(typeof slot?.update_repeating !== 'undefined' ? slot?.update_repeating : false),
438
+ update_repeating: new FormControl(!!slot?.update_repeating || false),
437
439
  reserved_time_enabled: new FormControl(typeof slot?.reserved_time_enabled !== 'undefined' ? slot?.reserved_time_enabled : false),
438
440
  reserved_time: new FormControl(slot?.reserved_time || '00:00'),
439
441
  reserved_time_position: new FormControl(slot?.reserved_time_position || ''),
@@ -442,7 +444,7 @@ class BookingCalendarSlot {
442
444
  }
443
445
 
444
446
  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) {
447
+ 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
448
  this.id = id;
447
449
  this.section_id = section_id;
448
450
  this.slot_id = slot_id;
@@ -462,6 +464,7 @@ class BookingCalendarSlotSession {
462
464
  this.repeat = repeat;
463
465
  this.activity_type_id = activity_type_id;
464
466
  this.color = color;
467
+ this.update_repeating = update_repeating;
465
468
  }
466
469
  static asFormGroup(session) {
467
470
  return new FormGroup({
@@ -480,6 +483,7 @@ class BookingCalendarSlotSession {
480
483
  location_part_id: new FormControl(session?.location_part_id || ''),
481
484
  repeat: new FormControl(session?.repeat || false),
482
485
  activity_type_id: new FormControl(session?.activity_type_id || null),
486
+ update_repeating: new FormControl(!!session?.update_repeating || false),
483
487
  });
484
488
  }
485
489
  }
@@ -1597,11 +1601,11 @@ const authTeamFactory = (apiAuthTeam) => new AuthTeam(apiAuthTeam.id, apiAuthTea
1597
1601
 
1598
1602
  const authFactory = (apiAuth) => new Auth(apiAuth.id, apiAuth.name, apiAuth.club_admin, apiAuth.is_section_club, apiAuth.members.map((apiAuthMember) => authMemberFactory(apiAuthMember)), apiAuth.registration_enabled, apiAuth.sections.map((apiAuthSection) => authSectionFactory(apiAuthSection)), apiAuth.site_enabled, apiAuth.teams.map((apiAuthTeam) => authTeamFactory(apiAuthTeam)), apiAuth.user_name);
1599
1603
 
1600
- const bookingCalendarFactory = (apiBookingCalendar) => new BookingCalendar(apiBookingCalendar.id, apiBookingCalendar.club_id, apiBookingCalendar.section_id, apiBookingCalendar.team_id, apiBookingCalendar.club_name, apiBookingCalendar.name, apiBookingCalendar.section_name, apiBookingCalendar.team_name, apiBookingCalendar.status, apiBookingCalendar.max_application_number, apiBookingCalendar.location_groups && apiBookingCalendar.location_groups.length ? apiBookingCalendar.location_groups.map((apiActivityLocationGroup) => activityLocationGroupFactory(apiActivityLocationGroup)) : []);
1604
+ const bookingCalendarFactory = (apiBookingCalendar) => new BookingCalendar(apiBookingCalendar.id, apiBookingCalendar.club_id, apiBookingCalendar.section_id, apiBookingCalendar.team_id, apiBookingCalendar.club_name, apiBookingCalendar.name, apiBookingCalendar.section_name, apiBookingCalendar.team_name, apiBookingCalendar.status, apiBookingCalendar.max_application_number, apiBookingCalendar.can_team_export, apiBookingCalendar.location_groups && apiBookingCalendar.location_groups.length ? apiBookingCalendar.location_groups.map((apiActivityLocationGroup) => activityLocationGroupFactory(apiActivityLocationGroup)) : []);
1601
1605
 
1602
1606
  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
1607
 
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);
1608
+ 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
1609
 
1606
1610
  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
1611
 
@@ -2498,6 +2502,7 @@ const CLUB_BOOKING_CALENDAR_SLOT_PATH = ':clubId/activities/slots/:id/';
2498
2502
  const CLUB_BOOKING_CALENDAR_REPEATABLE_SLOT_PATH = ':clubId/activities/slots/:id/all/';
2499
2503
  const CLUB_BOOKING_CALENDAR_SLOT_SESSIONS_PATH = ':clubId/activities/sessions/';
2500
2504
  const CLUB_BOOKING_CALENDAR_SLOT_SESSION_PATH = ':clubId/activities/sessions/:id/';
2505
+ const CLUB_BOOKING_CALENDAR_REPEATABLE_SESSION_PATH = ':clubId/activities/sessions/:id/all/';
2501
2506
  const CLUB_BOOKING_SETTINGS_PATH = ':clubId/activities/booking-settings/';
2502
2507
  const CLUB_BOOKING_CALENDAR_APPLICATION_TIME_PATH = ':clubId/activities/application-times/:id/';
2503
2508
  const CLUB_BOOKING_CALENDAR_APPLICATION_TIMES_PATH = ':clubId/activities/application-times/';
@@ -2512,6 +2517,7 @@ const SECTION_BOOKING_CALENDAR_SLOT_PATH = ':sectionId/activities/slots/:id/';
2512
2517
  const SECTION_BOOKING_CALENDAR_REPEATABLE_SLOT_PATH = ':sectionId/activities/slots/:id/all/';
2513
2518
  const SECTION_BOOKING_CALENDAR_SLOT_SESSIONS_PATH = ':sectionId/activities/sessions/';
2514
2519
  const SECTION_BOOKING_CALENDAR_SLOT_SESSION_PATH = ':sectionId/activities/sessions/:id/';
2520
+ const SECTION_BOOKING_CALENDAR_REPEATABLE_SESSION_PATH = ':sectionId/activities/sessions/:id/all/';
2515
2521
  const SECTION_BOOKING_SETTINGS_PATH = ':sectionId/activities/booking-settings/';
2516
2522
  const SECTION_BOOKING_CALENDAR_APPLICATION_TIME_PATH = ':sectionId/activities/application-times/:id/';
2517
2523
  const SECTION_BOOKING_CALENDAR_APPLICATION_TIMES_PATH = ':sectionId/activities/application-times/';
@@ -2852,13 +2858,13 @@ class BookingCalendarService {
2852
2858
  params
2853
2859
  });
2854
2860
  }
2855
- clearBookingCalendarSlots(role, clubOrSectionOrTeamId, currentWeekStartDate, weekRelativeIndexes, onlyDeleteSessions = false, bookingSlotFilter) {
2861
+ clearBookingCalendarSlots(role, clubOrSectionOrTeamId, currentWeekStartDate, weekRelativeIndexes, onlyDeleteSessions = false, shouldDeleteRepeatingSlots = false, bookingSlotFilter) {
2856
2862
  if (role === Role.ClubAdmin) {
2857
- return this.clearClubBookingCalendarSlots(clubOrSectionOrTeamId, currentWeekStartDate, weekRelativeIndexes, onlyDeleteSessions, bookingSlotFilter);
2863
+ return this.clearClubBookingCalendarSlots(clubOrSectionOrTeamId, currentWeekStartDate, weekRelativeIndexes, onlyDeleteSessions, shouldDeleteRepeatingSlots, bookingSlotFilter);
2858
2864
  }
2859
- return this.clearSectionBookingCalendarSlots(clubOrSectionOrTeamId, currentWeekStartDate, weekRelativeIndexes, onlyDeleteSessions, bookingSlotFilter);
2865
+ return this.clearSectionBookingCalendarSlots(clubOrSectionOrTeamId, currentWeekStartDate, weekRelativeIndexes, onlyDeleteSessions, shouldDeleteRepeatingSlots, bookingSlotFilter);
2860
2866
  }
2861
- clearClubBookingCalendarSlots(clubId, currentWeekStartDate, weekRelativeIndexes, onlyDeleteSessions = false, bookingSlotFilter) {
2867
+ clearClubBookingCalendarSlots(clubId, currentWeekStartDate, weekRelativeIndexes, onlyDeleteSessions = false, shouldDeleteRepeatingSlots = false, bookingSlotFilter) {
2862
2868
  const params = bookingSlotFilter.toParams();
2863
2869
  return this.apiService
2864
2870
  .deleteResourceWithBody(Role.ClubAdmin, CLUB_BOOKING_CALENDAR_SLOTS_CLEAR_PATH, { clubId }, {
@@ -2866,11 +2872,12 @@ class BookingCalendarService {
2866
2872
  current_week_start_date: currentWeekStartDate,
2867
2873
  week_relative_indexes: weekRelativeIndexes,
2868
2874
  only_delete_sessions: onlyDeleteSessions,
2875
+ should_delete_repeating_slots: shouldDeleteRepeatingSlots,
2869
2876
  },
2870
2877
  params,
2871
2878
  });
2872
2879
  }
2873
- clearSectionBookingCalendarSlots(sectionId, currentWeekStartDate, weekRelativeIndexes, onlyDeleteSessions = false, bookingSlotFilter) {
2880
+ clearSectionBookingCalendarSlots(sectionId, currentWeekStartDate, weekRelativeIndexes, onlyDeleteSessions = false, shouldDeleteRepeatingSlots = false, bookingSlotFilter) {
2874
2881
  const params = bookingSlotFilter.toParams();
2875
2882
  return this.apiService
2876
2883
  .deleteResourceWithBody(Role.SectionAdmin, SECTION_BOOKING_CALENDAR_SLOTS_CLEAR_PATH, { sectionId }, {
@@ -2878,6 +2885,7 @@ class BookingCalendarService {
2878
2885
  current_week_start_date: currentWeekStartDate,
2879
2886
  week_relative_indexes: weekRelativeIndexes,
2880
2887
  only_delete_sessions: onlyDeleteSessions,
2888
+ should_delete_repeating_slots: shouldDeleteRepeatingSlots,
2881
2889
  },
2882
2890
  params,
2883
2891
  });
@@ -2955,25 +2963,25 @@ class BookingCalendarService {
2955
2963
  id
2956
2964
  });
2957
2965
  }
2958
- deleteBookingCalendarSlotRepeatable(role, clubOrSectionOrTeamId, id) {
2966
+ deleteBookingCalendarSlotRepeatable(role, clubOrSectionOrTeamId, id, deleteUntilDate) {
2959
2967
  if (role === Role.ClubAdmin) {
2960
- return this.deleteClubBookingCalendarSlotRepeatable(clubOrSectionOrTeamId, id);
2968
+ return this.deleteClubBookingCalendarSlotRepeatable(clubOrSectionOrTeamId, id, deleteUntilDate);
2961
2969
  }
2962
- return this.deleteSectionBookingCalendarSlotRepeatable(clubOrSectionOrTeamId, id);
2970
+ return this.deleteSectionBookingCalendarSlotRepeatable(clubOrSectionOrTeamId, id, deleteUntilDate);
2963
2971
  }
2964
- deleteClubBookingCalendarSlotRepeatable(clubId, id) {
2972
+ deleteClubBookingCalendarSlotRepeatable(clubId, id, deleteUntilDate) {
2965
2973
  return this.apiService
2966
- .deleteResource(Role.ClubAdmin, CLUB_BOOKING_CALENDAR_REPEATABLE_SLOT_PATH, {
2974
+ .deleteResourceWithBody(Role.ClubAdmin, CLUB_BOOKING_CALENDAR_REPEATABLE_SLOT_PATH, {
2967
2975
  clubId,
2968
2976
  id
2969
- });
2977
+ }, { body: { delete_until_date: deleteUntilDate } });
2970
2978
  }
2971
- deleteSectionBookingCalendarSlotRepeatable(sectionId, id) {
2979
+ deleteSectionBookingCalendarSlotRepeatable(sectionId, id, deleteUntilDate) {
2972
2980
  return this.apiService
2973
- .deleteResource(Role.SectionAdmin, SECTION_BOOKING_CALENDAR_REPEATABLE_SLOT_PATH, {
2981
+ .deleteResourceWithBody(Role.SectionAdmin, SECTION_BOOKING_CALENDAR_REPEATABLE_SLOT_PATH, {
2974
2982
  sectionId,
2975
2983
  id
2976
- });
2984
+ }, { body: { delete_until_date: deleteUntilDate } });
2977
2985
  }
2978
2986
  // endregion
2979
2987
  // region Booking calendar slot session
@@ -3067,6 +3075,26 @@ class BookingCalendarService {
3067
3075
  id
3068
3076
  });
3069
3077
  }
3078
+ deleteBookingCalendarSlotSessionRepeatable(role, clubOrSectionOrTeamId, id, deleteUntilDate) {
3079
+ if (role === Role.ClubAdmin) {
3080
+ return this.deleteClubBookingCalendarSlotSessionRepeatable(clubOrSectionOrTeamId, id, deleteUntilDate);
3081
+ }
3082
+ return this.deleteSectionBookingCalendarSlotSessionRepeatable(clubOrSectionOrTeamId, id, deleteUntilDate);
3083
+ }
3084
+ deleteClubBookingCalendarSlotSessionRepeatable(clubId, id, deleteUntilDate) {
3085
+ return this.apiService
3086
+ .deleteResourceWithBody(Role.ClubAdmin, CLUB_BOOKING_CALENDAR_REPEATABLE_SESSION_PATH, {
3087
+ clubId,
3088
+ id
3089
+ }, { body: { delete_until_date: deleteUntilDate } });
3090
+ }
3091
+ deleteSectionBookingCalendarSlotSessionRepeatable(sectionId, id, deleteUntilDate) {
3092
+ return this.apiService
3093
+ .deleteResourceWithBody(Role.SectionAdmin, SECTION_BOOKING_CALENDAR_REPEATABLE_SESSION_PATH, {
3094
+ sectionId,
3095
+ id
3096
+ }, { body: { delete_until_date: deleteUntilDate } });
3097
+ }
3070
3098
  // endregion
3071
3099
  // region Booking Setting
3072
3100
  getBookingSettings(role, clubOrSectionOrTeamId) {
@@ -3156,6 +3184,29 @@ class BookingCalendarService {
3156
3184
  teamId,
3157
3185
  }, availableTime);
3158
3186
  }
3187
+ deleteBookingCalendarApplicationTime(role, clubOrSectionOrTeamId, availableTimeId) {
3188
+ if (role == Role.ClubAdmin) {
3189
+ return this.deleteClubBookingCalendarApplicationTime(clubOrSectionOrTeamId, availableTimeId);
3190
+ }
3191
+ else if (role == Role.SectionAdmin) {
3192
+ return this.deleteSectionBookingCalendarApplicationTime(clubOrSectionOrTeamId, availableTimeId);
3193
+ }
3194
+ return this.deleteTeamBookingCalendarApplicationTime(clubOrSectionOrTeamId, availableTimeId);
3195
+ }
3196
+ deleteClubBookingCalendarApplicationTime(clubId, id) {
3197
+ return this.apiService
3198
+ .deleteResource(Role.ClubAdmin, CLUB_BOOKING_CALENDAR_APPLICATION_TIME_PATH, {
3199
+ clubId,
3200
+ id
3201
+ });
3202
+ }
3203
+ deleteSectionBookingCalendarApplicationTime(sectionId, id) {
3204
+ return this.apiService
3205
+ .deleteResource(Role.SectionAdmin, SECTION_BOOKING_CALENDAR_APPLICATION_TIME_PATH, {
3206
+ sectionId,
3207
+ id
3208
+ });
3209
+ }
3159
3210
  deleteTeamBookingCalendarApplicationTime(teamId, id) {
3160
3211
  return this.apiService
3161
3212
  .deleteResource(Role.TeamAdmin, TEAM_BOOKING_CALENDAR_APPLICATION_TIME_PATH, {