@myclub_se/data-access 1.5.2 → 1.5.3

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.
@@ -807,10 +807,19 @@ class MemberAttribute {
807
807
  this.value = value;
808
808
  }
809
809
  static asFormGroup(attribute = null) {
810
+ const attributeOptions = new FormArray(attribute?.options?.map((option) => new FormGroup({
811
+ text: new FormControl(option.text),
812
+ value: new FormControl(option.value)
813
+ })) || []);
810
814
  return new FormGroup({
811
815
  field_id: new FormControl(attribute?.field_id || ''),
812
816
  member_id: new FormControl(attribute?.member_id || ''),
813
- value: new FormControl(attribute?.value || '')
817
+ leader_editable: new FormControl(attribute?.leader_editable || false),
818
+ member_editable: new FormControl(attribute?.member_editable || false),
819
+ name: new FormControl(attribute?.name || ''),
820
+ options: attributeOptions,
821
+ type: new FormControl(attribute?.type || 'text'),
822
+ value: new FormControl(attribute?.type === 'bool' ? attribute?.value : attribute?.value || '')
814
823
  });
815
824
  }
816
825
  }
@@ -1179,7 +1188,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.11", ngImpo
1179
1188
 
1180
1189
  const searchMemberFactory = (apiSearchMember) => new SearchMember(apiSearchMember.id, apiSearchMember.club_id, apiSearchMember.team_id, apiSearchMember.address1, apiSearchMember.address2, apiSearchMember.calendar_url, apiSearchMember.country, apiSearchMember.district, apiSearchMember.email, apiSearchMember.first_name, apiSearchMember.image, apiSearchMember.last_name, apiSearchMember.mobile_phone, apiSearchMember.name, apiSearchMember.zip);
1181
1190
 
1182
- const memberAttributeFactory = (attribute) => new MemberAttribute(attribute.display_value, attribute.field, attribute.leader_editable, attribute.member_id, attribute.member_editable, attribute.name, attribute.options, attribute.order, attribute.section_id, attribute.type, attribute.value);
1191
+ const memberAttributeFactory = (attribute) => new MemberAttribute(attribute.display_value, attribute.field_id, attribute.leader_editable, attribute.member_id, attribute.member_editable, attribute.name, attribute.options, attribute.order, attribute.section_id, attribute.type, attribute.value);
1183
1192
 
1184
1193
  const contactFactory = (contact) => new Contact(contact.id, contact.club_id, contact.member_id, contact.address1, contact.address2, contact.address3, contact.country, contact.district, contact.email, contact.first_name, contact.home_phone, contact.last_name, contact.mobile_phone, contact.work_phone, contact.zip);
1185
1194
 
@@ -1403,19 +1412,10 @@ class ActivityService {
1403
1412
  });
1404
1413
  }
1405
1414
  createTeamActivity(teamId, data) {
1406
- if (typeof data.id !== 'undefined') {
1407
- delete data.id;
1408
- }
1409
- if (typeof data.file !== 'undefined' && !data.file) {
1410
- delete data.file;
1411
- }
1412
- if (typeof data.invite_last_response_date !== 'undefined' && !data.invite_last_response_date) {
1413
- delete data.invite_last_response_date;
1414
- }
1415
1415
  return this.apiService
1416
1416
  .postResource(activityFactory, Role.TeamAdmin, TEAM_ACTIVITIES_PATH, {
1417
1417
  teamId
1418
- }, data);
1418
+ }, this.removeUnusedActivityFields(data));
1419
1419
  }
1420
1420
  deleteTeamActivity(teamId, id) {
1421
1421
  return this.apiService
@@ -1547,7 +1547,7 @@ class ActivityService {
1547
1547
  .updateResource(activityFactory, Role.TeamAdmin, TEAM_ACTIVITY_PATH, {
1548
1548
  teamId,
1549
1549
  id: activity.id
1550
- }, activity);
1550
+ }, this.removeUnusedActivityFields(activity));
1551
1551
  }
1552
1552
  updateTeamActivityInvite(teamId, activityId, activityInviteId, activityInvite) {
1553
1553
  return this.apiService
@@ -1566,6 +1566,18 @@ class ActivityService {
1566
1566
  members
1567
1567
  });
1568
1568
  }
1569
+ removeUnusedActivityFields(activity) {
1570
+ if (typeof activity.id !== 'undefined') {
1571
+ delete activity.id;
1572
+ }
1573
+ if (typeof activity.file !== 'undefined' && !activity.file) {
1574
+ delete activity.file;
1575
+ }
1576
+ if (typeof activity.invite_last_response_date !== 'undefined' && !activity.invite_last_response_date) {
1577
+ delete activity.invite_last_response_date;
1578
+ }
1579
+ return activity;
1580
+ }
1569
1581
  }
1570
1582
  ActivityService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: ActivityService, deps: [{ token: ApiService }], target: i0.ɵɵFactoryTarget.Injectable });
1571
1583
  ActivityService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: ActivityService, providedIn: 'root' });