@myclub_se/data-access 1.5.3 → 1.7.0

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.
Files changed (71) hide show
  1. package/esm2020/lib/api-models/api-booking-calendar-slot-session.mjs +2 -0
  2. package/esm2020/lib/api-models/api-booking-calendar-slot.mjs +2 -0
  3. package/esm2020/lib/api-models/api-booking-calendar.mjs +2 -0
  4. package/esm2020/lib/api-models/api-member-activity-invite.mjs +1 -1
  5. package/esm2020/lib/api-models/api-member-team.mjs +1 -1
  6. package/esm2020/lib/api-models/api-search-team.mjs +2 -0
  7. package/esm2020/lib/api-models/index.mjs +5 -4
  8. package/esm2020/lib/models/booking-calendar-slot-session.mjs +26 -0
  9. package/esm2020/lib/models/booking-calendar-slot.mjs +29 -0
  10. package/esm2020/lib/models/booking-calendar.mjs +28 -0
  11. package/esm2020/lib/models/index.mjs +4 -3
  12. package/esm2020/lib/models/member-activity-invite.mjs +3 -2
  13. package/esm2020/lib/models/member-team.mjs +3 -2
  14. package/esm2020/lib/models/search-team.mjs +5 -2
  15. package/esm2020/lib/services/activity.service.mjs +13 -2
  16. package/esm2020/lib/services/booking-calendar.service.mjs +143 -0
  17. package/esm2020/lib/services/factories/booking-calendar-factory.mjs +3 -0
  18. package/esm2020/lib/services/factories/booking-calendar-slot-factory.mjs +4 -0
  19. package/esm2020/lib/services/factories/booking-calendar-slot-session-factory.mjs +3 -0
  20. package/esm2020/lib/services/factories/index.mjs +1 -4
  21. package/esm2020/lib/services/factories/member-invite-factory.mjs +2 -2
  22. package/esm2020/lib/services/factories/member-team-factory.mjs +2 -2
  23. package/esm2020/lib/services/factories/search-team-factory.mjs +5 -0
  24. package/esm2020/lib/services/index.mjs +2 -1
  25. package/esm2020/lib/services/team.service.mjs +8 -7
  26. package/esm2020/lib/types/booking-calendar-slot-type.mjs +2 -0
  27. package/fesm2015/myclub_se-data-access.mjs +251 -33
  28. package/fesm2015/myclub_se-data-access.mjs.map +1 -1
  29. package/fesm2020/myclub_se-data-access.mjs +251 -33
  30. package/fesm2020/myclub_se-data-access.mjs.map +1 -1
  31. package/lib/api-models/api-booking-calendar-slot-session.d.ts +10 -0
  32. package/lib/api-models/api-booking-calendar-slot.d.ts +16 -0
  33. package/lib/api-models/api-booking-calendar.d.ts +11 -0
  34. package/lib/api-models/api-member-activity-invite.d.ts +1 -0
  35. package/lib/api-models/api-member-team.d.ts +1 -0
  36. package/lib/api-models/api-search-team.d.ts +8 -0
  37. package/lib/api-models/index.d.ts +4 -3
  38. package/lib/models/booking-calendar-slot-session.d.ts +22 -0
  39. package/lib/models/booking-calendar-slot.d.ts +27 -0
  40. package/lib/models/booking-calendar.d.ts +24 -0
  41. package/lib/models/index.d.ts +3 -2
  42. package/lib/models/member-activity-invite.d.ts +2 -1
  43. package/lib/models/member-team.d.ts +2 -1
  44. package/lib/models/search-team.d.ts +6 -1
  45. package/lib/services/activity.service.d.ts +1 -0
  46. package/lib/services/booking-calendar.service.d.ts +27 -0
  47. package/lib/services/factories/booking-calendar-factory.d.ts +3 -0
  48. package/lib/services/factories/booking-calendar-slot-factory.d.ts +3 -0
  49. package/lib/services/factories/booking-calendar-slot-session-factory.d.ts +3 -0
  50. package/lib/services/factories/index.d.ts +0 -3
  51. package/lib/services/factories/search-team-factory.d.ts +3 -0
  52. package/lib/services/index.d.ts +1 -0
  53. package/lib/services/team.service.d.ts +4 -4
  54. package/lib/types/booking-calendar-slot-type.d.ts +1 -0
  55. package/package.json +1 -1
  56. package/esm2020/lib/api-models/api-club-team.mjs +0 -2
  57. package/esm2020/lib/api-models/api-search-member-team.mjs +0 -2
  58. package/esm2020/lib/api-models/api-section-team.mjs +0 -2
  59. package/esm2020/lib/models/club-team.mjs +0 -7
  60. package/esm2020/lib/models/search-member-team.mjs +0 -9
  61. package/esm2020/lib/services/factories/club-team-factory.mjs +0 -3
  62. package/esm2020/lib/services/factories/search-member-team-factory.mjs +0 -5
  63. package/esm2020/lib/services/factories/section-team-factory.mjs +0 -3
  64. package/lib/api-models/api-club-team.d.ts +0 -4
  65. package/lib/api-models/api-search-member-team.d.ts +0 -7
  66. package/lib/api-models/api-section-team.d.ts +0 -4
  67. package/lib/models/club-team.d.ts +0 -5
  68. package/lib/models/search-member-team.d.ts +0 -8
  69. package/lib/services/factories/club-team-factory.d.ts +0 -3
  70. package/lib/services/factories/search-member-team-factory.d.ts +0 -3
  71. package/lib/services/factories/section-team-factory.d.ts +0 -3
@@ -218,6 +218,86 @@ class Authentication {
218
218
  }
219
219
  }
220
220
 
221
+ class BookingCalendar {
222
+ constructor(id, club_id, section_id, team_id, club_name, color, name, section_name, team_name) {
223
+ this.id = id;
224
+ this.club_id = club_id;
225
+ this.section_id = section_id;
226
+ this.team_id = team_id;
227
+ this.club_name = club_name;
228
+ this.color = color;
229
+ this.name = name;
230
+ this.section_name = section_name;
231
+ this.team_name = team_name;
232
+ }
233
+ static asFormGroup(calendar) {
234
+ return new FormGroup({
235
+ id: new FormControl((calendar === null || calendar === void 0 ? void 0 : calendar.id) || ''),
236
+ club_id: new FormControl((calendar === null || calendar === void 0 ? void 0 : calendar.club_id) || ''),
237
+ section_id: new FormControl((calendar === null || calendar === void 0 ? void 0 : calendar.section_id) || ''),
238
+ team_id: new FormControl((calendar === null || calendar === void 0 ? void 0 : calendar.team_id) || ''),
239
+ club_name: new FormControl((calendar === null || calendar === void 0 ? void 0 : calendar.club_name) || ''),
240
+ color: new FormControl((calendar === null || calendar === void 0 ? void 0 : calendar.color) || '', Validators.required),
241
+ name: new FormControl((calendar === null || calendar === void 0 ? void 0 : calendar.name) || '', Validators.required),
242
+ section_name: new FormControl((calendar === null || calendar === void 0 ? void 0 : calendar.section_name) || ''),
243
+ team_name: new FormControl((calendar === null || calendar === void 0 ? void 0 : calendar.team_name) || '')
244
+ });
245
+ }
246
+ }
247
+
248
+ class BookingCalendarSlot {
249
+ constructor(id, calendar_id, location_id, color, day, end_time, location_name, number_of_available_sessions, sessions, start_time, type) {
250
+ this.id = id;
251
+ this.calendar_id = calendar_id;
252
+ this.location_id = location_id;
253
+ this.color = color;
254
+ this.day = day;
255
+ this.end_time = end_time;
256
+ this.location_name = location_name;
257
+ this.number_of_available_sessions = number_of_available_sessions;
258
+ this.sessions = sessions;
259
+ this.start_time = start_time;
260
+ this.type = type;
261
+ }
262
+ static asFormGroup(slot) {
263
+ return new FormGroup({
264
+ id: new FormControl((slot === null || slot === void 0 ? void 0 : slot.id) || ''),
265
+ calendar_id: new FormControl((slot === null || slot === void 0 ? void 0 : slot.calendar_id) || ''),
266
+ location_id: new FormControl((slot === null || slot === void 0 ? void 0 : slot.location_id) || '', Validators.required),
267
+ day: new FormControl((slot === null || slot === void 0 ? void 0 : slot.day) || '', Validators.required),
268
+ end_time: new FormControl((slot === null || slot === void 0 ? void 0 : slot.end_time) || '', Validators.required),
269
+ number_of_available_sessions: new FormControl((slot === null || slot === void 0 ? void 0 : slot.number_of_available_sessions) || 0, Validators.required),
270
+ start_time: new FormControl((slot === null || slot === void 0 ? void 0 : slot.start_time) || '', Validators.required),
271
+ type: new FormControl((slot === null || slot === void 0 ? void 0 : slot.type) || '', Validators.required),
272
+ });
273
+ }
274
+ }
275
+
276
+ class BookingCalendarSlotSession {
277
+ constructor(id, section_id, slot_id, team_id, end_time, section_name, start_time, team_name) {
278
+ this.id = id;
279
+ this.section_id = section_id;
280
+ this.slot_id = slot_id;
281
+ this.team_id = team_id;
282
+ this.end_time = end_time;
283
+ this.section_name = section_name;
284
+ this.start_time = start_time;
285
+ this.team_name = team_name;
286
+ }
287
+ static asFormGroup(session) {
288
+ return new FormGroup({
289
+ id: new FormControl((session === null || session === void 0 ? void 0 : session.id) || ''),
290
+ section_id: new FormControl((session === null || session === void 0 ? void 0 : session.section_id) || ''),
291
+ slot_id: new FormControl((session === null || session === void 0 ? void 0 : session.slot_id) || '', Validators.required),
292
+ team_id: new FormControl((session === null || session === void 0 ? void 0 : session.team_id) || ''),
293
+ end_time: new FormControl((session === null || session === void 0 ? void 0 : session.end_time) || '', Validators.required),
294
+ section_name: new FormControl((session === null || session === void 0 ? void 0 : session.section_name) || ''),
295
+ start_time: new FormControl((session === null || session === void 0 ? void 0 : session.start_time) || '', Validators.required),
296
+ team_name: new FormControl((session === null || session === void 0 ? void 0 : session.team_name) || '')
297
+ });
298
+ }
299
+ }
300
+
221
301
  class Calendar {
222
302
  constructor(id, club_id, section_id, name, types_to_show) {
223
303
  this.id = id;
@@ -404,13 +484,6 @@ class ClubSection {
404
484
  }
405
485
  }
406
486
 
407
- class ClubTeam {
408
- constructor(id, name) {
409
- this.id = id;
410
- this.name = name;
411
- }
412
- }
413
-
414
487
  class Collection {
415
488
  constructor(count, next, previous, resources) {
416
489
  this.count = count;
@@ -896,9 +969,10 @@ class SearchMember {
896
969
  }
897
970
 
898
971
  class MemberActivityInvite {
899
- constructor(id, comment, last_invite, leader, member_email, member_id, member_name, next_invite, response_date, status) {
972
+ constructor(id, comment, current_num_attendants, last_invite, leader, member_email, member_id, member_name, next_invite, response_date, status) {
900
973
  this.id = id;
901
974
  this.comment = comment;
975
+ this.current_num_attendants = current_num_attendants;
902
976
  this.last_invite = last_invite;
903
977
  this.leader = leader;
904
978
  this.member_email = member_email;
@@ -936,13 +1010,14 @@ class MemberPublicForm {
936
1010
  }
937
1011
 
938
1012
  class MemberTeam {
939
- constructor(club, section, id, email, name, phone) {
1013
+ constructor(club, section, id, email, name, phone, section_name) {
940
1014
  this.club = club;
941
1015
  this.section = section;
942
1016
  this.id = id;
943
1017
  this.email = email;
944
1018
  this.name = name;
945
1019
  this.phone = phone;
1020
+ this.section_name = section_name;
946
1021
  }
947
1022
  }
948
1023
 
@@ -1028,19 +1103,13 @@ class SearchClub {
1028
1103
  }
1029
1104
  }
1030
1105
 
1031
- class SearchMemberTeam {
1032
- constructor(club, id, name, section) {
1106
+ class SearchTeam {
1107
+ constructor(club, section, id, name, section_name) {
1033
1108
  this.club = club;
1034
- this.id = id;
1035
- this.name = name;
1036
1109
  this.section = section;
1037
- }
1038
- }
1039
-
1040
- class SearchTeam {
1041
- constructor(id, name) {
1042
1110
  this.id = id;
1043
1111
  this.name = name;
1112
+ this.section_name = section_name;
1044
1113
  }
1045
1114
  }
1046
1115
 
@@ -1207,7 +1276,7 @@ const memberFactory = (apiMember) => new Member(apiMember.id, apiMember.club_id,
1207
1276
  const activityExtraMemberFactory = (apiActivityExtraMember) => new ActivityExtraMember(apiActivityExtraMember.id, apiActivityExtraMember.member_id, apiActivityExtraMember.team_id, apiActivityExtraMember.created, apiActivityExtraMember.leader, apiActivityExtraMember.member.birth_date ?
1208
1277
  memberFactory(apiActivityExtraMember.member) : searchMemberFactory(apiActivityExtraMember.member), apiActivityExtraMember.member_name);
1209
1278
 
1210
- const memberActivityInviteFactory = (invitedMember) => new MemberActivityInvite(invitedMember.id, invitedMember.comment, invitedMember.last_invite, invitedMember.leader, invitedMember.member_email, invitedMember.member_id, invitedMember.member_name, invitedMember.next_invite, invitedMember.response_date, invitedMember.status);
1279
+ const memberActivityInviteFactory = (invitedMember) => new MemberActivityInvite(invitedMember.id, invitedMember.comment, invitedMember.current_num_attendants, invitedMember.last_invite, invitedMember.leader, invitedMember.member_email, invitedMember.member_id, invitedMember.member_name, invitedMember.next_invite, invitedMember.response_date, invitedMember.status);
1211
1280
 
1212
1281
  const activityFactory = (apiActivity) => new Activity(apiActivity.id, apiActivity.activity_group_id, apiActivity.activity_type_id, apiActivity.club_id, apiActivity.location_id, apiActivity.team_id, apiActivity.activity_location, apiActivity.activity_type_name, apiActivity.allow_maybe, apiActivity.calendar_name, apiActivity.created, apiActivity.current_num_attendants, apiActivity.day, apiActivity.description, apiActivity.end_time, apiActivity.file, apiActivity.invitation_text, apiActivity.invite_first_days, [], apiActivity.invite_hide_before_sent, apiActivity.invite_last_response_date, apiActivity.invite_remind, apiActivity.invite_remind_receivers, apiActivity.invite_second_days, 'same_as_last', (apiActivity.invited_members && apiActivity.invited_members.length) ? apiActivity.invited_members.map((invitedMember) => memberActivityInviteFactory(invitedMember)) : [], apiActivity.last_response_date, apiActivity.max_num_attendants, apiActivity.max_num_attendants_type, apiActivity.meet_up_place, apiActivity.meet_up_time, apiActivity.meet_up_time_display, 'none', 6, format(new Date(), 'yyyy-MM-dd'), 'repeat_until', apiActivity.show_other_invited, apiActivity.start_time, apiActivity.title, apiActivity.updated, apiActivity.use_invite, false);
1213
1282
 
@@ -1261,8 +1330,6 @@ const clubImageFactory = (apiClubImage) => new ClubImage(apiClubImage.club_id, a
1261
1330
 
1262
1331
  const clubSectionFactory = (apiSection) => new ClubSection(apiSection.id, apiSection.name);
1263
1332
 
1264
- const clubTeamFactory = (apiClubTeam) => new SearchTeam(apiClubTeam.id, apiClubTeam.name);
1265
-
1266
1333
  const creditCardFactory = (apiCreditCard) => new CreditCard(apiCreditCard.club_id, apiCreditCard.section_id, apiCreditCard.default_activated, apiCreditCard.merchant_id, apiCreditCard.name, apiCreditCard.payment_terms_name, apiCreditCard.payment_terms_organisation_id, apiCreditCard.payment_terms_url, apiCreditCard.rsa_key, apiCreditCard.status, apiCreditCard.test_account);
1267
1334
 
1268
1335
  const fileFactory = (file) => new FileObject(file.id, file.created, null, typeof file.member === 'undefined' ? null : file.member, file.name, typeof file.section === 'undefined' ? null : file.section, typeof file.team === 'undefined' ? null : file.team, file.updated, file.url);
@@ -1291,7 +1358,7 @@ const memberPublicFormFactory = (apiMemberPublicForm) => new MemberPublicForm(ap
1291
1358
 
1292
1359
  const sectionFactory = (apiSection) => new Section(apiSection.id, apiSection.name);
1293
1360
 
1294
- const memberTeamFactory = (apiMemberTeam) => new MemberTeam(clubFactory(apiMemberTeam.club), apiMemberTeam.section ? sectionFactory(apiMemberTeam.section) : null, apiMemberTeam.id, apiMemberTeam.email, apiMemberTeam.name, apiMemberTeam.phone);
1361
+ const memberTeamFactory = (apiMemberTeam) => new MemberTeam(clubFactory(apiMemberTeam.club), apiMemberTeam.section ? sectionFactory(apiMemberTeam.section) : null, apiMemberTeam.id, apiMemberTeam.email, apiMemberTeam.name, apiMemberTeam.phone, apiMemberTeam.section_name);
1295
1362
 
1296
1363
  const memberTeamThroughFactory = (apiMemberTeamThrough) => new MemberTeamThrough(apiMemberTeamThrough.id, apiMemberTeamThrough.created, apiMemberTeamThrough.date_hidden, apiMemberTeamThrough.image, apiMemberTeamThrough.leader, memberFactory(apiMemberTeamThrough.member), apiMemberTeamThrough.role_id, apiMemberTeamThrough.show_on_web, apiMemberTeamThrough.updated);
1297
1364
 
@@ -1325,12 +1392,8 @@ const searchMemberCardFactory = (apiSearchMemberCard) => new SearchMemberCard(ap
1325
1392
 
1326
1393
  const searchMemberInvoiceFactory = (apiSearchMemberInvoice) => new SearchMemberInvoice(apiSearchMemberInvoice.id, apiSearchMemberInvoice.amount, apiSearchMemberInvoice.amount_paid, apiSearchMemberInvoice.balance, apiSearchMemberInvoice.club_bill_id, apiSearchMemberInvoice.date_paid, apiSearchMemberInvoice.due_date, apiSearchMemberInvoice.is_paid, apiSearchMemberInvoice.member_id);
1327
1394
 
1328
- const searchMemberTeamFactory = (apiSearchMemberTeam) => new SearchMemberTeam(clubFactory(apiSearchMemberTeam.club), apiSearchMemberTeam.id, apiSearchMemberTeam.name, apiSearchMemberTeam.section ? sectionFactory(apiSearchMemberTeam.section) : null);
1329
-
1330
1395
  const searchMemberTeamThroughFactory = (apiMemberTeamThrough) => new MemberTeamThrough(apiMemberTeamThrough.id, apiMemberTeamThrough.created, apiMemberTeamThrough.date_hidden, apiMemberTeamThrough.image, apiMemberTeamThrough.leader, searchMemberFactory(apiMemberTeamThrough.member), apiMemberTeamThrough.role_id, apiMemberTeamThrough.show_on_web, apiMemberTeamThrough.updated);
1331
1396
 
1332
- const sectionTeamFactory = (apiSectionTeam) => new SearchTeam(apiSectionTeam.id, apiSectionTeam.name);
1333
-
1334
1397
  const tokenFactory = (apiToken) => new Token(apiToken.access_token, apiToken.refresh_token);
1335
1398
 
1336
1399
  const userFactory = (apiUser) => new User(apiUser.device_token, apiUser.email, apiUser.first_name, apiUser.is_staff, apiUser.language, apiUser.last_name, apiUser.new_email);
@@ -1394,13 +1457,14 @@ const TEAM_ACTIVITIES_PATH = ':teamId/activities/';
1394
1457
  const TEAM_ACTIVITY_INVITES_PATH = ':teamId/activities/:activityId/invites/';
1395
1458
  const TEAM_ACTIVITY_INVITE_PATH = ':teamId/activities/:activityId/invites/:activityInviteId/';
1396
1459
  const TEAM_ACTIVITY_INVITE_RESEND_PATH = ':teamId/activities/:activityId/invites/:activityInviteId/resend-invite/';
1397
- const TEAM_ACTIVITY_LOCATIONS_PATH = ':teamId/activities/locations/';
1398
1460
  const TEAM_ACTIVITY_NEW_PATH = ':teamId/activities/new/';
1399
1461
  const TEAM_ACTIVITY_PARTICIPANTS_PATH = ':teamId/activities/:activityId/participants/';
1400
1462
  const TEAM_ACTIVITY_PATH = ':teamId/activities/:id/';
1401
1463
  const TEAM_ACTIVITY_SETTINGS_PATH = ':teamId/activities/settings/';
1402
1464
  const TEAM_ACTIVITY_TYPES_PATH = ':teamId/activities/types/';
1403
1465
  const TEAM_CALENDAR_PATH = ':teamId/activities/calendar/';
1466
+ const TEAM_ACTIVITY_LOCATIONS_PATH = ':teamId/activities/locations/';
1467
+ const CLUB_ACTIVITY_LOCATIONS_PATH = ':clubId/activities/locations/';
1404
1468
  class ActivityService {
1405
1469
  constructor(apiService) {
1406
1470
  this.apiService = apiService;
@@ -1483,6 +1547,16 @@ class ActivityService {
1483
1547
  this.activityLocationCollection = activityLocationCollection;
1484
1548
  }));
1485
1549
  }
1550
+ getClubActivityLocations(clubId) {
1551
+ if (this.activityLocationResponseDate && this.activityLocationResponseDate > sub(new Date(), { hours: 1 })) {
1552
+ return of(this.activityLocationCollection);
1553
+ }
1554
+ return this.apiService
1555
+ .getCollection(activityLocationFactory, Role.ClubAdmin, CLUB_ACTIVITY_LOCATIONS_PATH, { clubId }, { params: { limit: 'null' } }).pipe(tap((activityLocationCollection) => {
1556
+ this.activityLocationResponseDate = new Date();
1557
+ this.activityLocationCollection = activityLocationCollection;
1558
+ }));
1559
+ }
1486
1560
  getTeamActivityNew(teamId) {
1487
1561
  return this.apiService
1488
1562
  .getResource(activityFactory, Role.TeamAdmin, TEAM_ACTIVITY_NEW_PATH, { teamId });
@@ -1591,6 +1665,148 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.11", ngImpo
1591
1665
  }]
1592
1666
  }], ctorParameters: function () { return [{ type: ApiService }]; } });
1593
1667
 
1668
+ const bookingCalendarFactory = (apiBookingCalendar) => new BookingCalendar(apiBookingCalendar.id, apiBookingCalendar.club_id, apiBookingCalendar.section_id, apiBookingCalendar.team_id, apiBookingCalendar.club_name, apiBookingCalendar.color, apiBookingCalendar.name, apiBookingCalendar.section_name, apiBookingCalendar.team_name);
1669
+
1670
+ 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);
1671
+
1672
+ const bookingCalendarSlotFactory = (apiBookingSlot) => new BookingCalendarSlot(apiBookingSlot.id, apiBookingSlot.calendar_id, apiBookingSlot.location_id, apiBookingSlot.color, apiBookingSlot.day, apiBookingSlot.end_time, apiBookingSlot.location_name, apiBookingSlot.number_of_available_sessions, apiBookingSlot.sessions && apiBookingSlot.sessions.length ? apiBookingSlot.sessions.map((apiBookingSlotSession) => bookingCalendarSlotSessionFactory(apiBookingSlotSession)) : [], apiBookingSlot.start_time, apiBookingSlot.type);
1673
+
1674
+ const CLUB_BOOKING_CALENDARS_PATH = ':clubId/activities/calendars/';
1675
+ const CLUB_BOOKING_CALENDAR_PATH = ':clubId/activities/calendars/:id/';
1676
+ const CLUB_BOOKING_CALENDAR_SLOTS_PATH = ':clubId/activities/slots/';
1677
+ const CLUB_BOOKING_CALENDAR_SLOT_PATH = ':clubId/activities/slots/:id/';
1678
+ const CLUB_BOOKING_CALENDAR_SLOT_SESSIONS_PATH = ':clubId/activities/sessions/';
1679
+ const CLUB_BOOKING_CALENDAR_SLOT_SESSION_PATH = ':clubId/activities/sessions/:id/';
1680
+ class BookingCalendarService {
1681
+ constructor(apiService) {
1682
+ this.apiService = apiService;
1683
+ }
1684
+ // region Booking calendar
1685
+ createClubBookingCalendar(clubId, calendar) {
1686
+ delete calendar.id;
1687
+ return this.apiService
1688
+ .postResource(bookingCalendarFactory, Role.ClubAdmin, CLUB_BOOKING_CALENDARS_PATH, {
1689
+ clubId,
1690
+ }, calendar);
1691
+ }
1692
+ getClubBookingCalendars(clubId, name = null) {
1693
+ const params = { limit: 'null' };
1694
+ if (name) {
1695
+ params['name'] = name;
1696
+ }
1697
+ return this.apiService
1698
+ .getCollection(bookingCalendarFactory, Role.ClubAdmin, CLUB_BOOKING_CALENDARS_PATH, { clubId }, {
1699
+ params
1700
+ });
1701
+ }
1702
+ getClubBookingCalendar(clubId, id) {
1703
+ return this.apiService
1704
+ .getResource(bookingCalendarFactory, Role.ClubAdmin, CLUB_BOOKING_CALENDAR_PATH, { clubId, id });
1705
+ }
1706
+ updateClubBookingCalendar(clubId, calendar) {
1707
+ return this.apiService
1708
+ .updateResource(bookingCalendarFactory, Role.ClubAdmin, CLUB_BOOKING_CALENDAR_PATH, {
1709
+ clubId,
1710
+ id: calendar.id
1711
+ }, calendar);
1712
+ }
1713
+ deleteClubBookingCalendar(clubId, id) {
1714
+ return this.apiService
1715
+ .deleteResource(Role.ClubAdmin, CLUB_BOOKING_CALENDAR_PATH, {
1716
+ clubId,
1717
+ id
1718
+ });
1719
+ }
1720
+ // endregion
1721
+ // region Booking calendar slot
1722
+ createClubBookingCalendarSlot(clubId, slot) {
1723
+ delete slot.id;
1724
+ return this.apiService
1725
+ .postResource(bookingCalendarSlotFactory, Role.ClubAdmin, CLUB_BOOKING_CALENDAR_SLOTS_PATH, {
1726
+ clubId,
1727
+ }, slot);
1728
+ }
1729
+ getClubBookingCalendarSlots(clubId, startDate = null, endDate = null) {
1730
+ const params = { limit: 'null' };
1731
+ if (startDate) {
1732
+ params['day__gte'] = startDate;
1733
+ }
1734
+ if (endDate) {
1735
+ params['day__lte'] = endDate;
1736
+ }
1737
+ return this.apiService
1738
+ .getCollection(bookingCalendarSlotFactory, Role.ClubAdmin, CLUB_BOOKING_CALENDAR_SLOTS_PATH, { clubId }, {
1739
+ params
1740
+ });
1741
+ }
1742
+ getClubBookingCalendarSlot(clubId, id) {
1743
+ return this.apiService
1744
+ .getResource(bookingCalendarSlotFactory, Role.ClubAdmin, CLUB_BOOKING_CALENDAR_SLOT_PATH, { clubId, id });
1745
+ }
1746
+ updateClubBookingCalendarSlot(clubId, slot) {
1747
+ return this.apiService
1748
+ .updateResource(bookingCalendarSlotFactory, Role.ClubAdmin, CLUB_BOOKING_CALENDAR_SLOT_PATH, {
1749
+ clubId,
1750
+ id: slot.id
1751
+ }, slot);
1752
+ }
1753
+ deleteClubBookingCalendarSlot(clubId, id) {
1754
+ return this.apiService
1755
+ .deleteResource(Role.ClubAdmin, CLUB_BOOKING_CALENDAR_SLOT_PATH, {
1756
+ clubId,
1757
+ id
1758
+ });
1759
+ }
1760
+ // endregion
1761
+ // region Booking calendar slot session
1762
+ createClubBookingCalendarSlotSession(clubId, session) {
1763
+ delete session.id;
1764
+ return this.apiService
1765
+ .postResource(bookingCalendarSlotSessionFactory, Role.ClubAdmin, CLUB_BOOKING_CALENDAR_SLOT_SESSIONS_PATH, {
1766
+ clubId,
1767
+ }, session);
1768
+ }
1769
+ getClubBookingCalendarSlotSessions(clubId, startDate = null, endDate = null) {
1770
+ const params = { limit: 'null' };
1771
+ if (startDate) {
1772
+ params['day__gte'] = startDate;
1773
+ }
1774
+ if (endDate) {
1775
+ params['day__lte'] = endDate;
1776
+ }
1777
+ return this.apiService
1778
+ .getCollection(bookingCalendarSlotSessionFactory, Role.ClubAdmin, CLUB_BOOKING_CALENDAR_SLOT_SESSIONS_PATH, { clubId }, {
1779
+ params
1780
+ });
1781
+ }
1782
+ getClubBookingCalendarSlotSession(clubId, id) {
1783
+ return this.apiService
1784
+ .getResource(bookingCalendarSlotSessionFactory, Role.ClubAdmin, CLUB_BOOKING_CALENDAR_SLOT_SESSION_PATH, { clubId, id });
1785
+ }
1786
+ updateClubBookingCalendarSlotSession(clubId, session) {
1787
+ return this.apiService
1788
+ .updateResource(bookingCalendarSlotSessionFactory, Role.ClubAdmin, CLUB_BOOKING_CALENDAR_SLOT_SESSION_PATH, {
1789
+ clubId,
1790
+ id: session.id
1791
+ }, session);
1792
+ }
1793
+ deleteClubBookingCalendarSlotSession(clubId, id) {
1794
+ return this.apiService
1795
+ .deleteResource(Role.ClubAdmin, CLUB_BOOKING_CALENDAR_SLOT_SESSION_PATH, {
1796
+ clubId,
1797
+ id
1798
+ });
1799
+ }
1800
+ }
1801
+ BookingCalendarService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: BookingCalendarService, deps: [{ token: ApiService }], target: i0.ɵɵFactoryTarget.Injectable });
1802
+ BookingCalendarService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: BookingCalendarService, providedIn: 'root' });
1803
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: BookingCalendarService, decorators: [{
1804
+ type: Injectable,
1805
+ args: [{
1806
+ providedIn: 'root'
1807
+ }]
1808
+ }], ctorParameters: function () { return [{ type: ApiService }]; } });
1809
+
1594
1810
  const MEMBER_CLUB_INFO = ':memberId/club-info/';
1595
1811
  const TEAM_CLUB_INFO = ':teamId/club-info/';
1596
1812
  class ClubService {
@@ -2218,6 +2434,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.11", ngImpo
2218
2434
  }]
2219
2435
  }], ctorParameters: function () { return [{ type: ApiService }]; } });
2220
2436
 
2437
+ const searchTeamFactory = (apiSearchTeam) => new SearchTeam(apiSearchTeam.club ? clubFactory(apiSearchTeam.club) : undefined, apiSearchTeam.section ? sectionFactory(apiSearchTeam.section) : undefined, apiSearchTeam.id, apiSearchTeam.name, apiSearchTeam.section_name);
2438
+
2221
2439
  const CLUB_TEAMS_PATH = ':clubId/teams/';
2222
2440
  const MEMBER_TEAM_MEMBER_PATH = ':memberId/teams/:teamId/team-members/:id/';
2223
2441
  const MEMBER_TEAM_MEMBERS_PATH = ':memberId/teams/:teamId/team-members/';
@@ -2225,7 +2443,7 @@ const MEMBER_TEAM_EXTRA_MEMBER_PATH = ':memberId/teams/:teamId/extra-members/:id
2225
2443
  const MEMBER_TEAM_EXTRA_MEMBERS_PATH = ':memberId/teams/:teamId/extra-members/';
2226
2444
  const MEMBER_TEAM_PATH = ':memberId/teams/:teamId/';
2227
2445
  const MEMBER_TEAMS_PATH = ':memberId/teams/';
2228
- const SECTION_TEAMS_PATH = 'sections/:sectionId/teams/';
2446
+ const SECTION_TEAMS_PATH = ':sectionId/teams/';
2229
2447
  const TEAM_LEADER_TEAM_MEMBER_PATH = ':teamId/team-members/:id/';
2230
2448
  const TEAM_LEADER_TEAM_MEMBERS_PATH = ':teamId/team-members/';
2231
2449
  const TEAM_LEADER_TEAM_PATH = ':teamId/team-detail/';
@@ -2239,7 +2457,7 @@ class TeamService {
2239
2457
  return this.apiService.deleteResource(Role.TeamAdmin, TEAM_LEADER_TEAM_MEMBER_PATH, { teamId, id });
2240
2458
  }
2241
2459
  getClubTeams(clubId) {
2242
- return this.apiService.getCollection(clubTeamFactory, Role.ClubAdmin, CLUB_TEAMS_PATH, { clubId });
2460
+ return this.apiService.getCollection(searchTeamFactory, Role.ClubAdmin, CLUB_TEAMS_PATH, { clubId });
2243
2461
  }
2244
2462
  getMemberTeam(memberId, teamId) {
2245
2463
  return this.apiService.getResource(memberTeamFactory, Role.MemberAdmin, MEMBER_TEAM_PATH, { memberId, teamId });
@@ -2257,10 +2475,10 @@ class TeamService {
2257
2475
  return this.apiService.getCollection(searchMemberTeamThroughFactory, Role.MemberAdmin, MEMBER_TEAM_MEMBERS_PATH, { memberId, teamId }, { params: { member_q: q, offset: offset.toString(10) } });
2258
2476
  }
2259
2477
  getMemberTeams(memberId) {
2260
- return this.apiService.getCollection(searchMemberTeamFactory, Role.MemberAdmin, MEMBER_TEAMS_PATH, { memberId });
2478
+ return this.apiService.getCollection(searchTeamFactory, Role.MemberAdmin, MEMBER_TEAMS_PATH, { memberId });
2261
2479
  }
2262
- getSectionTeams(role, sectionId) {
2263
- return this.apiService.getCollection(sectionTeamFactory, role, SECTION_TEAMS_PATH, { sectionId });
2480
+ getSectionTeams(sectionId) {
2481
+ return this.apiService.getCollection(searchTeamFactory, Role.SectionAdmin, SECTION_TEAMS_PATH, { sectionId });
2264
2482
  }
2265
2483
  getTeamLeaderTeam(teamId) {
2266
2484
  return this.apiService.getResource(memberTeamFactory, Role.TeamAdmin, TEAM_LEADER_TEAM_PATH, { teamId });
@@ -2630,5 +2848,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.11", ngImpo
2630
2848
  * Generated bundle index. Do not edit.
2631
2849
  */
2632
2850
 
2633
- export { APP, Activity, ActivityExtraMember, ActivityInvite, ActivityLocation, ActivityService, ActivitySettings, ActivityType, Auth, AuthMember, AuthSection, AuthService, AuthTeam, AuthTeamSection, AuthenticatedGuard, Authentication, AuthenticationInterceptor, AuthenticationService, Calendar, CalendarEvent, Card, CardDeal, CardLogo, CardLogoUrls, CardMemberTicket, CardTheme, CardTicket, CardTicketLocation, Club, ClubImage, ClubSection, ClubService, ClubTeam, Collection, ConstantService, Contact, CreditCard, DataAccessModule, Directory, Email, EmailRecipient, EmailService, Event, ExternalLink, ExternalLinkService, FileObject, FileService, GeneralImage, Giro, HandleGrantTokenGuard, HomeTeam, ImageUrls, InvoiceService, Member, MemberActivityInvite, MemberAttribute, MemberCard, MemberCardService, MemberContact, MemberFee, MemberFunction, MemberInvoice, MemberInvoiceRow, MemberPublicForm, MemberPublicFormService, MemberService, MemberTeam, MemberTeamThrough, MemberValidationSettings, News, NewsService, Partner, PaymentAttempt, PaymentAttemptService, Role, SearchClub, SearchMember, SearchMemberCard, SearchMemberInvoice, SearchMemberTeam, SearchTeam, Section, SectionService, Swish, SwishQrCode, TeamService, Token, TokenService, USER_NOTIFICATIONS_PATH, UnpaidMemberInvoice, User, UserNotification, UserNotificationService, UserService, Zimpler };
2851
+ export { APP, Activity, ActivityExtraMember, ActivityInvite, ActivityLocation, ActivityService, ActivitySettings, ActivityType, Auth, AuthMember, AuthSection, AuthService, AuthTeam, AuthTeamSection, AuthenticatedGuard, Authentication, AuthenticationInterceptor, AuthenticationService, BookingCalendar, BookingCalendarService, BookingCalendarSlot, BookingCalendarSlotSession, Calendar, CalendarEvent, Card, CardDeal, CardLogo, CardLogoUrls, CardMemberTicket, CardTheme, CardTicket, CardTicketLocation, Club, ClubImage, ClubSection, ClubService, Collection, ConstantService, Contact, CreditCard, DataAccessModule, Directory, Email, EmailRecipient, EmailService, Event, ExternalLink, ExternalLinkService, FileObject, FileService, GeneralImage, Giro, HandleGrantTokenGuard, HomeTeam, ImageUrls, InvoiceService, Member, MemberActivityInvite, MemberAttribute, MemberCard, MemberCardService, MemberContact, MemberFee, MemberFunction, MemberInvoice, MemberInvoiceRow, MemberPublicForm, MemberPublicFormService, MemberService, MemberTeam, MemberTeamThrough, MemberValidationSettings, News, NewsService, Partner, PaymentAttempt, PaymentAttemptService, Role, SearchClub, SearchMember, SearchMemberCard, SearchMemberInvoice, SearchTeam, Section, SectionService, Swish, SwishQrCode, TeamService, Token, TokenService, USER_NOTIFICATIONS_PATH, UnpaidMemberInvoice, User, UserNotification, UserNotificationService, UserService, Zimpler };
2634
2852
  //# sourceMappingURL=myclub_se-data-access.mjs.map