@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?.location_id || '', Validators.required),
267
284
  day: new FormControl(slot?.day || '', Validators.required),
268
285
  end_time: new FormControl(slot?.end_time || '', Validators.required),
286
+ group_id: new FormControl(slot?.group_id || null, { nonNullable: false }),
269
287
  number_of_available_sessions: new FormControl(slot?.number_of_available_sessions || 0, Validators.required),
270
288
  start_time: new FormControl(slot?.start_time || '', Validators.required),
271
289
  type: new FormControl(slot?.type || '', Validators.required),
290
+ repeat: new FormControl(slot?.repeat || 'none'),
291
+ repeat_num: new FormControl(slot?.repeat_num || 6, Validators.max(24)),
292
+ repeat_to_day: new FormControl(slot?.repeat_to_day || ''),
293
+ repeat_type: new FormControl(slot?.repeat_type || ''),
294
+ update_repeating: new FormControl(typeof slot?.update_repeating !== 'undefined' ? 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;
@@ -1460,6 +1476,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.11", ngImpo
1460
1476
  }]
1461
1477
  }], ctorParameters: function () { return [{ type: ApiService }]; } });
1462
1478
 
1479
+ const activityLocationGroupFactory = (apiActivityLocationGroup) => {
1480
+ 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)) : []);
1481
+ };
1482
+
1463
1483
  const MEMBER_ACTIVITY_INVITE_PATH = ':memberId/activities/:activityInviteId/';
1464
1484
  const MEMBER_ACTIVITY_INVITES_PATH = ':memberId/activities/';
1465
1485
  const MEMBER_CALENDAR_PATH = ':memberId/activities/calendar/';
@@ -1472,10 +1492,12 @@ const TEAM_ACTIVITY_NEW_PATH = ':teamId/activities/new/';
1472
1492
  const TEAM_ACTIVITY_PARTICIPANTS_PATH = ':teamId/activities/:activityId/participants/';
1473
1493
  const TEAM_ACTIVITY_PATH = ':teamId/activities/:id/';
1474
1494
  const TEAM_ACTIVITY_SETTINGS_PATH = ':teamId/activities/settings/';
1495
+ const CLUB_ACTIVITY_SETTINGS_PATH = ':clubId/activities/settings/';
1475
1496
  const TEAM_ACTIVITY_TYPES_PATH = ':teamId/activities/types/';
1476
1497
  const TEAM_CALENDAR_PATH = ':teamId/activities/calendar/';
1477
1498
  const TEAM_ACTIVITY_LOCATIONS_PATH = ':teamId/activities/locations/';
1478
1499
  const CLUB_ACTIVITY_LOCATIONS_PATH = ':clubId/activities/locations/';
1500
+ const CLUB_ACTIVITY_LOCATION_GROUPS_PATH = ':clubId/activities/locations/groups/';
1479
1501
  class ActivityService {
1480
1502
  constructor(apiService) {
1481
1503
  this.apiService = apiService;
@@ -1568,6 +1590,16 @@ class ActivityService {
1568
1590
  this.activityLocationCollection = activityLocationCollection;
1569
1591
  }));
1570
1592
  }
1593
+ getClubActivityLocationGroups(clubId) {
1594
+ if (this.activityLocationGroupResponseDate && this.activityLocationGroupResponseDate > sub(new Date(), { hours: 1 })) {
1595
+ return of(this.activityLocationGroupCollection);
1596
+ }
1597
+ return this.apiService
1598
+ .getCollection(activityLocationGroupFactory, Role.ClubAdmin, CLUB_ACTIVITY_LOCATION_GROUPS_PATH, { clubId }, { params: { limit: 'null' } }).pipe(tap((activityLocationGroupCollection) => {
1599
+ this.activityLocationGroupResponseDate = new Date();
1600
+ this.activityLocationGroupCollection = activityLocationGroupCollection;
1601
+ }));
1602
+ }
1571
1603
  getTeamActivityNew(teamId) {
1572
1604
  return this.apiService
1573
1605
  .getResource(activityFactory, Role.TeamAdmin, TEAM_ACTIVITY_NEW_PATH, { teamId });
@@ -1585,6 +1617,12 @@ class ActivityService {
1585
1617
  teamId
1586
1618
  });
1587
1619
  }
1620
+ getClubActivitySettings(clubId) {
1621
+ return this.apiService
1622
+ .getResource(activitySettingsFactory, Role.ClubAdmin, CLUB_ACTIVITY_SETTINGS_PATH, {
1623
+ clubId,
1624
+ });
1625
+ }
1588
1626
  getTeamActivityTypes(teamId) {
1589
1627
  if (this.activityTypeResponseDate && this.activityTypeResponseDate > sub(new Date(), { hours: 1 })) {
1590
1628
  return of(this.activityTypeCollection);
@@ -1647,7 +1685,8 @@ class ActivityService {
1647
1685
  }
1648
1686
  updateTeamActivityParticipants(teamId, activityId, members) {
1649
1687
  return this.apiService
1650
- .postResource(() => { }, Role.TeamAdmin, TEAM_ACTIVITY_PARTICIPANTS_PATH, {
1688
+ .postResource(() => {
1689
+ }, Role.TeamAdmin, TEAM_ACTIVITY_PARTICIPANTS_PATH, {
1651
1690
  teamId,
1652
1691
  activityId
1653
1692
  }, {
@@ -1680,12 +1719,13 @@ const bookingCalendarFactory = (apiBookingCalendar) => new BookingCalendar(apiBo
1680
1719
 
1681
1720
  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);
1682
1721
 
1683
- 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);
1722
+ 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');
1684
1723
 
1685
1724
  const CLUB_BOOKING_CALENDARS_PATH = ':clubId/activities/calendars/';
1686
1725
  const CLUB_BOOKING_CALENDAR_PATH = ':clubId/activities/calendars/:id/';
1687
1726
  const CLUB_BOOKING_CALENDAR_SLOTS_PATH = ':clubId/activities/slots/';
1688
1727
  const CLUB_BOOKING_CALENDAR_SLOT_PATH = ':clubId/activities/slots/:id/';
1728
+ const CLUB_BOOKING_CALENDAR_REPEATABLE_SLOT_PATH = ':clubId/activities/slots/:id/all/';
1689
1729
  const CLUB_BOOKING_CALENDAR_SLOT_SESSIONS_PATH = ':clubId/activities/sessions/';
1690
1730
  const CLUB_BOOKING_CALENDAR_SLOT_SESSION_PATH = ':clubId/activities/sessions/:id/';
1691
1731
  class BookingCalendarService {
@@ -1737,7 +1777,7 @@ class BookingCalendarService {
1737
1777
  clubId,
1738
1778
  }, slot);
1739
1779
  }
1740
- getClubBookingCalendarSlots(clubId, startDate = null, endDate = null) {
1780
+ getClubBookingCalendarSlots(clubId, startDate = null, endDate = null, calendarIds = null, locationIds = null) {
1741
1781
  const params = { limit: 'null' };
1742
1782
  if (startDate) {
1743
1783
  params['day__gte'] = startDate;
@@ -1745,6 +1785,12 @@ class BookingCalendarService {
1745
1785
  if (endDate) {
1746
1786
  params['day__lte'] = endDate;
1747
1787
  }
1788
+ if (calendarIds && calendarIds.length) {
1789
+ params['calendar_id'] = calendarIds.join(',');
1790
+ }
1791
+ if (locationIds && locationIds.length) {
1792
+ params['location_id'] = locationIds.join(',');
1793
+ }
1748
1794
  return this.apiService
1749
1795
  .getCollection(bookingCalendarSlotFactory, Role.ClubAdmin, CLUB_BOOKING_CALENDAR_SLOTS_PATH, { clubId }, {
1750
1796
  params
@@ -1768,6 +1814,13 @@ class BookingCalendarService {
1768
1814
  id
1769
1815
  });
1770
1816
  }
1817
+ deleteClubBookingCalendarSlotRepeatable(clubId, id) {
1818
+ return this.apiService
1819
+ .deleteResource(Role.ClubAdmin, CLUB_BOOKING_CALENDAR_REPEATABLE_SLOT_PATH, {
1820
+ clubId,
1821
+ id
1822
+ });
1823
+ }
1771
1824
  // endregion
1772
1825
  // region Booking calendar slot session
1773
1826
  createClubBookingCalendarSlotSession(clubId, session) {
@@ -2868,5 +2921,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.11", ngImpo
2868
2921
  * Generated bundle index. Do not edit.
2869
2922
  */
2870
2923
 
2871
- 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 };
2924
+ 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 };
2872
2925
  //# sourceMappingURL=myclub_se-data-access.mjs.map