@myclub_se/data-access 1.9.0 → 2.0.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 (36) hide show
  1. package/esm2020/lib/api-models/api-activity-location-group.mjs +2 -0
  2. package/esm2020/lib/api-models/api-booking-calendar-slot.mjs +1 -1
  3. package/esm2020/lib/api-models/index.mjs +2 -1
  4. package/esm2020/lib/interfaces/email-recipient.interface.mjs +2 -0
  5. package/esm2020/lib/interfaces/index.mjs +3 -1
  6. package/esm2020/lib/interfaces/sms-recipient.interface.mjs +2 -0
  7. package/esm2020/lib/models/activity-location-group.mjs +11 -0
  8. package/esm2020/lib/models/booking-calendar-slot.mjs +14 -2
  9. package/esm2020/lib/models/email.mjs +1 -1
  10. package/esm2020/lib/models/index.mjs +2 -2
  11. package/esm2020/lib/services/activity.service.mjs +22 -2
  12. package/esm2020/lib/services/booking-calendar.service.mjs +16 -2
  13. package/esm2020/lib/services/email.service.mjs +1 -1
  14. package/esm2020/lib/services/factories/activity-location-group-factory.mjs +6 -0
  15. package/esm2020/lib/services/factories/booking-calendar-slot-factory.mjs +3 -2
  16. package/fesm2015/myclub_se-data-access.mjs +65 -12
  17. package/fesm2015/myclub_se-data-access.mjs.map +1 -1
  18. package/fesm2020/myclub_se-data-access.mjs +65 -12
  19. package/fesm2020/myclub_se-data-access.mjs.map +1 -1
  20. package/lib/api-models/api-activity-location-group.d.ts +9 -0
  21. package/lib/api-models/api-booking-calendar-slot.d.ts +6 -0
  22. package/lib/api-models/index.d.ts +1 -0
  23. package/lib/interfaces/email-recipient.interface.d.ts +4 -0
  24. package/lib/interfaces/index.d.ts +2 -0
  25. package/lib/interfaces/sms-recipient.interface.d.ts +4 -0
  26. package/lib/models/activity-location-group.d.ts +10 -0
  27. package/lib/models/booking-calendar-slot.d.ts +13 -1
  28. package/lib/models/email.d.ts +3 -3
  29. package/lib/models/index.d.ts +1 -1
  30. package/lib/services/activity.service.d.ts +5 -0
  31. package/lib/services/booking-calendar.service.d.ts +4 -4
  32. package/lib/services/email.service.d.ts +4 -3
  33. package/lib/services/factories/activity-location-group-factory.d.ts +3 -0
  34. package/package.json +1 -1
  35. package/esm2020/lib/models/email-recipient.mjs +0 -7
  36. package/lib/models/email-recipient.d.ts +0 -5
@@ -138,6 +138,17 @@ class ActivityLocation {
138
138
  }
139
139
  }
140
140
 
141
+ class ActivityLocationGroup {
142
+ constructor(id, club_id, section_id, active, name, locations) {
143
+ this.id = id;
144
+ this.club_id = club_id;
145
+ this.section_id = section_id;
146
+ this.active = active;
147
+ this.name = name;
148
+ this.locations = locations;
149
+ }
150
+ }
151
+
141
152
  class ActivitySettings {
142
153
  constructor(dayOptions, hourOptions, inviteGroupOptions, inviteSettingsOptions, maxAttendanceOptions, meetUpTimeOptions, remindReceiverOptions, repeatOptions, repeatTypeOptions) {
143
154
  this.dayOptions = dayOptions;
@@ -246,18 +257,24 @@ class BookingCalendar {
246
257
  }
247
258
 
248
259
  class BookingCalendarSlot {
249
- constructor(id, calendar_id, location_id, color, day, end_time, location_name, number_of_available_sessions, sessions, start_time, type) {
260
+ constructor(id, calendar_id, location_id, color, day, end_time, group_id, location_name, number_of_available_sessions, sessions, start_time, type, repeat, update_repeating, repeat_num, repeat_to_day, repeat_type) {
250
261
  this.id = id;
251
262
  this.calendar_id = calendar_id;
252
263
  this.location_id = location_id;
253
264
  this.color = color;
254
265
  this.day = day;
255
266
  this.end_time = end_time;
267
+ this.group_id = group_id;
256
268
  this.location_name = location_name;
257
269
  this.number_of_available_sessions = number_of_available_sessions;
258
270
  this.sessions = sessions;
259
271
  this.start_time = start_time;
260
272
  this.type = type;
273
+ this.repeat = repeat;
274
+ this.update_repeating = update_repeating;
275
+ this.repeat_num = repeat_num;
276
+ this.repeat_to_day = repeat_to_day;
277
+ this.repeat_type = repeat_type;
261
278
  }
262
279
  static asFormGroup(slot) {
263
280
  return new FormGroup({
@@ -266,9 +283,15 @@ class BookingCalendarSlot {
266
283
  location_id: new FormControl((slot === null || slot === void 0 ? void 0 : slot.location_id) || '', Validators.required),
267
284
  day: new FormControl((slot === null || slot === void 0 ? void 0 : slot.day) || '', Validators.required),
268
285
  end_time: new FormControl((slot === null || slot === void 0 ? void 0 : slot.end_time) || '', Validators.required),
286
+ group_id: new FormControl((slot === null || slot === void 0 ? void 0 : slot.group_id) || null, { nonNullable: false }),
269
287
  number_of_available_sessions: new FormControl((slot === null || slot === void 0 ? void 0 : slot.number_of_available_sessions) || 0, Validators.required),
270
288
  start_time: new FormControl((slot === null || slot === void 0 ? void 0 : slot.start_time) || '', Validators.required),
271
289
  type: new FormControl((slot === null || slot === void 0 ? void 0 : slot.type) || '', Validators.required),
290
+ repeat: new FormControl((slot === null || slot === void 0 ? void 0 : slot.repeat) || 'none'),
291
+ repeat_num: new FormControl((slot === null || slot === void 0 ? void 0 : slot.repeat_num) || 6, Validators.max(24)),
292
+ repeat_to_day: new FormControl((slot === null || slot === void 0 ? void 0 : slot.repeat_to_day) || ''),
293
+ repeat_type: new FormControl((slot === null || slot === void 0 ? void 0 : slot.repeat_type) || ''),
294
+ update_repeating: new FormControl(typeof (slot === null || slot === void 0 ? void 0 : slot.update_repeating) !== 'undefined' ? slot === null || slot === void 0 ? void 0 : slot.update_repeating : false)
272
295
  });
273
296
  }
274
297
  }
@@ -578,13 +601,6 @@ class Email {
578
601
  }
579
602
  }
580
603
 
581
- class EmailRecipient {
582
- constructor(id, name) {
583
- this.id = id;
584
- this.name = name;
585
- }
586
- }
587
-
588
604
  class Event {
589
605
  constructor(id, activity_id, activity_type, base_background_color, base_color, base_name, calendar_name, description, end, invitation_id, invitation_response, location, meet_up_place, meet_up_time, member_id, start, title, type) {
590
606
  this.id = id;
@@ -1463,6 +1479,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.11", ngImpo
1463
1479
  }]
1464
1480
  }], ctorParameters: function () { return [{ type: ApiService }]; } });
1465
1481
 
1482
+ const activityLocationGroupFactory = (apiActivityLocationGroup) => {
1483
+ return new ActivityLocationGroup(apiActivityLocationGroup.id, apiActivityLocationGroup.club_id, apiActivityLocationGroup.section_id, apiActivityLocationGroup.active, apiActivityLocationGroup.name, apiActivityLocationGroup.locations && apiActivityLocationGroup.locations.length ? apiActivityLocationGroup.locations.map((apiActivityLocation) => activityLocationFactory(apiActivityLocation)) : []);
1484
+ };
1485
+
1466
1486
  const MEMBER_ACTIVITY_INVITE_PATH = ':memberId/activities/:activityInviteId/';
1467
1487
  const MEMBER_ACTIVITY_INVITES_PATH = ':memberId/activities/';
1468
1488
  const MEMBER_CALENDAR_PATH = ':memberId/activities/calendar/';
@@ -1475,10 +1495,12 @@ const TEAM_ACTIVITY_NEW_PATH = ':teamId/activities/new/';
1475
1495
  const TEAM_ACTIVITY_PARTICIPANTS_PATH = ':teamId/activities/:activityId/participants/';
1476
1496
  const TEAM_ACTIVITY_PATH = ':teamId/activities/:id/';
1477
1497
  const TEAM_ACTIVITY_SETTINGS_PATH = ':teamId/activities/settings/';
1498
+ const CLUB_ACTIVITY_SETTINGS_PATH = ':clubId/activities/settings/';
1478
1499
  const TEAM_ACTIVITY_TYPES_PATH = ':teamId/activities/types/';
1479
1500
  const TEAM_CALENDAR_PATH = ':teamId/activities/calendar/';
1480
1501
  const TEAM_ACTIVITY_LOCATIONS_PATH = ':teamId/activities/locations/';
1481
1502
  const CLUB_ACTIVITY_LOCATIONS_PATH = ':clubId/activities/locations/';
1503
+ const CLUB_ACTIVITY_LOCATION_GROUPS_PATH = ':clubId/activities/locations/groups/';
1482
1504
  class ActivityService {
1483
1505
  constructor(apiService) {
1484
1506
  this.apiService = apiService;
@@ -1571,6 +1593,16 @@ class ActivityService {
1571
1593
  this.activityLocationCollection = activityLocationCollection;
1572
1594
  }));
1573
1595
  }
1596
+ getClubActivityLocationGroups(clubId) {
1597
+ if (this.activityLocationGroupResponseDate && this.activityLocationGroupResponseDate > sub(new Date(), { hours: 1 })) {
1598
+ return of(this.activityLocationGroupCollection);
1599
+ }
1600
+ return this.apiService
1601
+ .getCollection(activityLocationGroupFactory, Role.ClubAdmin, CLUB_ACTIVITY_LOCATION_GROUPS_PATH, { clubId }, { params: { limit: 'null' } }).pipe(tap((activityLocationGroupCollection) => {
1602
+ this.activityLocationGroupResponseDate = new Date();
1603
+ this.activityLocationGroupCollection = activityLocationGroupCollection;
1604
+ }));
1605
+ }
1574
1606
  getTeamActivityNew(teamId) {
1575
1607
  return this.apiService
1576
1608
  .getResource(activityFactory, Role.TeamAdmin, TEAM_ACTIVITY_NEW_PATH, { teamId });
@@ -1588,6 +1620,12 @@ class ActivityService {
1588
1620
  teamId
1589
1621
  });
1590
1622
  }
1623
+ getClubActivitySettings(clubId) {
1624
+ return this.apiService
1625
+ .getResource(activitySettingsFactory, Role.ClubAdmin, CLUB_ACTIVITY_SETTINGS_PATH, {
1626
+ clubId,
1627
+ });
1628
+ }
1591
1629
  getTeamActivityTypes(teamId) {
1592
1630
  if (this.activityTypeResponseDate && this.activityTypeResponseDate > sub(new Date(), { hours: 1 })) {
1593
1631
  return of(this.activityTypeCollection);
@@ -1650,7 +1688,8 @@ class ActivityService {
1650
1688
  }
1651
1689
  updateTeamActivityParticipants(teamId, activityId, members) {
1652
1690
  return this.apiService
1653
- .postResource(() => { }, Role.TeamAdmin, TEAM_ACTIVITY_PARTICIPANTS_PATH, {
1691
+ .postResource(() => {
1692
+ }, Role.TeamAdmin, TEAM_ACTIVITY_PARTICIPANTS_PATH, {
1654
1693
  teamId,
1655
1694
  activityId
1656
1695
  }, {
@@ -1683,12 +1722,13 @@ const bookingCalendarFactory = (apiBookingCalendar) => new BookingCalendar(apiBo
1683
1722
 
1684
1723
  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);
1685
1724
 
1686
- 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);
1725
+ const bookingCalendarSlotFactory = (apiBookingSlot) => new BookingCalendarSlot(apiBookingSlot.id, apiBookingSlot.calendar_id, 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.start_time, apiBookingSlot.type, 'none', false, 6, format(new Date(), 'yyyy-MM-dd'), 'repeat_until');
1687
1726
 
1688
1727
  const CLUB_BOOKING_CALENDARS_PATH = ':clubId/activities/calendars/';
1689
1728
  const CLUB_BOOKING_CALENDAR_PATH = ':clubId/activities/calendars/:id/';
1690
1729
  const CLUB_BOOKING_CALENDAR_SLOTS_PATH = ':clubId/activities/slots/';
1691
1730
  const CLUB_BOOKING_CALENDAR_SLOT_PATH = ':clubId/activities/slots/:id/';
1731
+ const CLUB_BOOKING_CALENDAR_REPEATABLE_SLOT_PATH = ':clubId/activities/slots/:id/all/';
1692
1732
  const CLUB_BOOKING_CALENDAR_SLOT_SESSIONS_PATH = ':clubId/activities/sessions/';
1693
1733
  const CLUB_BOOKING_CALENDAR_SLOT_SESSION_PATH = ':clubId/activities/sessions/:id/';
1694
1734
  class BookingCalendarService {
@@ -1740,7 +1780,7 @@ class BookingCalendarService {
1740
1780
  clubId,
1741
1781
  }, slot);
1742
1782
  }
1743
- getClubBookingCalendarSlots(clubId, startDate = null, endDate = null) {
1783
+ getClubBookingCalendarSlots(clubId, startDate = null, endDate = null, calendarIds = null, locationIds = null) {
1744
1784
  const params = { limit: 'null' };
1745
1785
  if (startDate) {
1746
1786
  params['day__gte'] = startDate;
@@ -1748,6 +1788,12 @@ class BookingCalendarService {
1748
1788
  if (endDate) {
1749
1789
  params['day__lte'] = endDate;
1750
1790
  }
1791
+ if (calendarIds && calendarIds.length) {
1792
+ params['calendar_id'] = calendarIds.join(',');
1793
+ }
1794
+ if (locationIds && locationIds.length) {
1795
+ params['location_id'] = locationIds.join(',');
1796
+ }
1751
1797
  return this.apiService
1752
1798
  .getCollection(bookingCalendarSlotFactory, Role.ClubAdmin, CLUB_BOOKING_CALENDAR_SLOTS_PATH, { clubId }, {
1753
1799
  params
@@ -1771,6 +1817,13 @@ class BookingCalendarService {
1771
1817
  id
1772
1818
  });
1773
1819
  }
1820
+ deleteClubBookingCalendarSlotRepeatable(clubId, id) {
1821
+ return this.apiService
1822
+ .deleteResource(Role.ClubAdmin, CLUB_BOOKING_CALENDAR_REPEATABLE_SLOT_PATH, {
1823
+ clubId,
1824
+ id
1825
+ });
1826
+ }
1774
1827
  // endregion
1775
1828
  // region Booking calendar slot session
1776
1829
  createClubBookingCalendarSlotSession(clubId, session) {
@@ -2871,5 +2924,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.11", ngImpo
2871
2924
  * Generated bundle index. Do not edit.
2872
2925
  */
2873
2926
 
2874
- 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 };
2927
+ export { APP, Activity, ActivityExtraMember, ActivityInvite, ActivityLocation, ActivityLocationGroup, 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, 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 };
2875
2928
  //# sourceMappingURL=myclub_se-data-access.mjs.map