@myclub_se/data-access 1.1.0 → 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.
- package/README.md +1 -1
- package/esm2020/lib/api-models/api-activity-invite.mjs +1 -1
- package/esm2020/lib/api-models/api-card/api-search-member-card.mjs +1 -1
- package/esm2020/lib/api-models/api-member/api-member-attribute.mjs +1 -1
- package/esm2020/lib/api-models/api-member-activity-invite.mjs +1 -1
- package/esm2020/lib/api-models/api-news.mjs +1 -1
- package/esm2020/lib/authentication/authentication.interceptor.mjs +32 -14
- package/esm2020/lib/authentication/authentication.service.mjs +1 -1
- package/esm2020/lib/data-access.module.mjs +5 -6
- package/esm2020/lib/models/activity-invite.mjs +3 -2
- package/esm2020/lib/models/activity.mjs +2 -1
- package/esm2020/lib/models/card/search-member-card.mjs +3 -2
- package/esm2020/lib/models/directory.mjs +9 -3
- package/esm2020/lib/models/file-object.mjs +3 -2
- package/esm2020/lib/models/index.mjs +2 -2
- package/esm2020/lib/models/member/member-attribute.mjs +12 -3
- package/esm2020/lib/models/member-activity-invite.mjs +5 -2
- package/esm2020/lib/models/news.mjs +23 -4
- package/esm2020/lib/models/search-team.mjs +7 -0
- package/esm2020/lib/services/activity.service.mjs +44 -9
- package/esm2020/lib/services/api.service.mjs +12 -6
- package/esm2020/lib/services/factories/activity-invite-factory.mjs +2 -2
- package/esm2020/lib/services/factories/club-team-factory.mjs +3 -0
- package/esm2020/lib/services/factories/file-factory.mjs +2 -2
- package/esm2020/lib/services/factories/index.mjs +3 -1
- package/esm2020/lib/services/factories/member-attribute-factory.mjs +2 -2
- package/esm2020/lib/services/factories/member-invite-factory.mjs +2 -2
- package/esm2020/lib/services/factories/news-factory.mjs +3 -2
- package/esm2020/lib/services/factories/search-member-card-factory.mjs +2 -2
- package/esm2020/lib/services/factories/section-team-factory.mjs +3 -0
- package/esm2020/lib/services/file.service.mjs +38 -3
- package/esm2020/lib/services/news.service.mjs +74 -3
- package/esm2020/lib/services/team.service.mjs +6 -6
- package/esm2020/lib/services/token.service.mjs +2 -2
- package/fesm2015/myclub_se-data-access.mjs +265 -56
- package/fesm2015/myclub_se-data-access.mjs.map +1 -1
- package/fesm2020/myclub_se-data-access.mjs +264 -56
- package/fesm2020/myclub_se-data-access.mjs.map +1 -1
- package/lib/api-models/api-activity-invite.d.ts +1 -0
- package/lib/api-models/api-card/api-search-member-card.d.ts +1 -0
- package/lib/api-models/api-member/api-member-attribute.d.ts +1 -1
- package/lib/api-models/api-member-activity-invite.d.ts +3 -0
- package/lib/api-models/api-news.d.ts +5 -3
- package/lib/authentication/authentication.interceptor.d.ts +3 -0
- package/lib/data-access.module.d.ts +1 -2
- package/lib/models/activity-invite.d.ts +2 -1
- package/lib/models/card/search-member-card.d.ts +2 -1
- package/lib/models/directory.d.ts +2 -2
- package/lib/models/file-object.d.ts +2 -1
- package/lib/models/index.d.ts +1 -1
- package/lib/models/member/member-attribute.d.ts +9 -1
- package/lib/models/member-activity-invite.d.ts +4 -1
- package/lib/models/news.d.ts +9 -5
- package/lib/models/{section-team.d.ts → search-team.d.ts} +1 -1
- package/lib/services/activity.service.d.ts +6 -3
- package/lib/services/api.service.d.ts +2 -1
- package/lib/services/factories/club-team-factory.d.ts +3 -0
- package/lib/services/factories/index.d.ts +2 -0
- package/lib/services/factories/section-team-factory.d.ts +3 -0
- package/lib/services/file.service.d.ts +5 -1
- package/lib/services/news.service.d.ts +9 -1
- package/lib/services/team.service.d.ts +2 -2
- package/package.json +5 -2
- package/esm2020/lib/models/section-team.mjs +0 -7
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { InjectionToken, Injectable, Inject, NgModule } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/common/http';
|
|
4
|
-
import { HttpErrorResponse, HttpParams, HttpRequest, HTTP_INTERCEPTORS
|
|
5
|
-
import { map, catchError, tap,
|
|
4
|
+
import { HttpErrorResponse, HttpParams, HttpRequest, HTTP_INTERCEPTORS } from '@angular/common/http';
|
|
5
|
+
import { map, catchError, tap, filter, take, switchMap } from 'rxjs/operators';
|
|
6
6
|
import { of, throwError, BehaviorSubject } from 'rxjs';
|
|
7
7
|
import { FormGroup, FormControl, Validators, FormArray } from '@angular/forms';
|
|
8
|
-
import { format } from 'date-fns';
|
|
8
|
+
import { format, sub } from 'date-fns';
|
|
9
9
|
import * as i2 from '@angular/router';
|
|
10
10
|
|
|
11
11
|
class Activity {
|
|
@@ -79,6 +79,7 @@ class Activity {
|
|
|
79
79
|
invite_settings: new FormControl((activity === null || activity === void 0 ? void 0 : activity.invite_settings) || ''),
|
|
80
80
|
last_response_date: new FormControl((activity === null || activity === void 0 ? void 0 : activity.last_response_date) || ''),
|
|
81
81
|
max_num_attendants: new FormControl((activity === null || activity === void 0 ? void 0 : activity.max_num_attendants) || 0),
|
|
82
|
+
max_num_attendants_type: new FormControl((activity === null || activity === void 0 ? void 0 : activity.max_num_attendants_type) || 'only_participants'),
|
|
82
83
|
meet_up_place: new FormControl((activity === null || activity === void 0 ? void 0 : activity.meet_up_place) || ''),
|
|
83
84
|
meet_up_time: new FormControl((activity === null || activity === void 0 ? void 0 : activity.meet_up_time) || 0),
|
|
84
85
|
repeat: new FormControl((activity === null || activity === void 0 ? void 0 : activity.repeat) || 'none'),
|
|
@@ -107,7 +108,7 @@ class ActivityExtraMember {
|
|
|
107
108
|
}
|
|
108
109
|
|
|
109
110
|
class ActivityInvite {
|
|
110
|
-
constructor(id, activity, comment, created, has_unpaid_invoices, last_invite, member, reminded, response_date, status, token, unpaid_invoices, updated) {
|
|
111
|
+
constructor(id, activity, comment, created, has_unpaid_invoices, last_invite, member, next_invite, reminded, response_date, status, token, unpaid_invoices, updated) {
|
|
111
112
|
this.id = id;
|
|
112
113
|
this.activity = activity;
|
|
113
114
|
this.comment = comment;
|
|
@@ -115,6 +116,7 @@ class ActivityInvite {
|
|
|
115
116
|
this.has_unpaid_invoices = has_unpaid_invoices;
|
|
116
117
|
this.last_invite = last_invite;
|
|
117
118
|
this.member = member;
|
|
119
|
+
this.next_invite = next_invite;
|
|
118
120
|
this.reminded = reminded;
|
|
119
121
|
this.response_date = response_date;
|
|
120
122
|
this.status = status;
|
|
@@ -362,9 +364,10 @@ class MemberCard {
|
|
|
362
364
|
}
|
|
363
365
|
|
|
364
366
|
class SearchMemberCard {
|
|
365
|
-
constructor(id, name, pdf_url) {
|
|
367
|
+
constructor(id, name, notification_count, pdf_url) {
|
|
366
368
|
this.id = id;
|
|
367
369
|
this.name = name;
|
|
370
|
+
this.notification_count = notification_count;
|
|
368
371
|
this.pdf_url = pdf_url;
|
|
369
372
|
}
|
|
370
373
|
}
|
|
@@ -480,10 +483,16 @@ class Directory {
|
|
|
480
483
|
this.location_name = location_name;
|
|
481
484
|
this.updated = updated;
|
|
482
485
|
}
|
|
483
|
-
belongsToTeam() {
|
|
486
|
+
belongsToTeam(teamId = null) {
|
|
487
|
+
if (teamId) {
|
|
488
|
+
return this.team_id === teamId;
|
|
489
|
+
}
|
|
484
490
|
return this.team_id !== null;
|
|
485
491
|
}
|
|
486
|
-
belongsToSection() {
|
|
492
|
+
belongsToSection(sectionId = null) {
|
|
493
|
+
if (sectionId) {
|
|
494
|
+
return this.section_id === sectionId;
|
|
495
|
+
}
|
|
487
496
|
return this.section_id !== null;
|
|
488
497
|
}
|
|
489
498
|
}
|
|
@@ -531,9 +540,10 @@ class ExternalLink {
|
|
|
531
540
|
}
|
|
532
541
|
|
|
533
542
|
class FileObject {
|
|
534
|
-
constructor(id, created, member, name, section, team, updated, url) {
|
|
543
|
+
constructor(id, created, file, member, name, section, team, updated, url) {
|
|
535
544
|
this.id = id;
|
|
536
545
|
this.created = created;
|
|
546
|
+
this.file = file;
|
|
537
547
|
this.member = member;
|
|
538
548
|
this.name = name;
|
|
539
549
|
this.section = section;
|
|
@@ -797,10 +807,20 @@ class MemberAttribute {
|
|
|
797
807
|
this.value = value;
|
|
798
808
|
}
|
|
799
809
|
static asFormGroup(attribute = null) {
|
|
810
|
+
var _a;
|
|
811
|
+
const attributeOptions = new FormArray(((_a = attribute === null || attribute === void 0 ? void 0 : attribute.options) === null || _a === void 0 ? void 0 : _a.map((option) => new FormGroup({
|
|
812
|
+
text: new FormControl(option.text),
|
|
813
|
+
value: new FormControl(option.value)
|
|
814
|
+
}))) || []);
|
|
800
815
|
return new FormGroup({
|
|
801
816
|
field_id: new FormControl((attribute === null || attribute === void 0 ? void 0 : attribute.field_id) || ''),
|
|
802
817
|
member_id: new FormControl((attribute === null || attribute === void 0 ? void 0 : attribute.member_id) || ''),
|
|
803
|
-
|
|
818
|
+
leader_editable: new FormControl((attribute === null || attribute === void 0 ? void 0 : attribute.leader_editable) || false),
|
|
819
|
+
member_editable: new FormControl((attribute === null || attribute === void 0 ? void 0 : attribute.member_editable) || false),
|
|
820
|
+
name: new FormControl((attribute === null || attribute === void 0 ? void 0 : attribute.name) || ''),
|
|
821
|
+
options: attributeOptions,
|
|
822
|
+
type: new FormControl((attribute === null || attribute === void 0 ? void 0 : attribute.type) || 'text'),
|
|
823
|
+
value: new FormControl((attribute === null || attribute === void 0 ? void 0 : attribute.type) === 'bool' ? attribute === null || attribute === void 0 ? void 0 : attribute.value : (attribute === null || attribute === void 0 ? void 0 : attribute.value) || '')
|
|
804
824
|
});
|
|
805
825
|
}
|
|
806
826
|
}
|
|
@@ -876,13 +896,16 @@ class SearchMember {
|
|
|
876
896
|
}
|
|
877
897
|
|
|
878
898
|
class MemberActivityInvite {
|
|
879
|
-
constructor(id, comment, last_invite, leader, member_id, member_name, status) {
|
|
899
|
+
constructor(id, comment, last_invite, leader, member_email, member_id, member_name, next_invite, response_date, status) {
|
|
880
900
|
this.id = id;
|
|
881
901
|
this.comment = comment;
|
|
882
902
|
this.last_invite = last_invite;
|
|
883
903
|
this.leader = leader;
|
|
904
|
+
this.member_email = member_email;
|
|
884
905
|
this.member_id = member_id;
|
|
885
906
|
this.member_name = member_name;
|
|
907
|
+
this.next_invite = next_invite;
|
|
908
|
+
this.response_date = response_date;
|
|
886
909
|
this.status = status;
|
|
887
910
|
}
|
|
888
911
|
getColorByStatus() {
|
|
@@ -938,7 +961,7 @@ class MemberTeamThrough {
|
|
|
938
961
|
}
|
|
939
962
|
|
|
940
963
|
class News {
|
|
941
|
-
constructor(id, club_id, created, created_by_id, section_id, team_id, active_to, author, ingress, news_image, news_image_text,
|
|
964
|
+
constructor(id, club_id, created, created_by_id, section_id, team_id, active_to, author, ingress, news_image, news_image_text, published_date, read, show_on_my_pages, text, title, updated, urls) {
|
|
942
965
|
this.id = id;
|
|
943
966
|
this.club_id = club_id;
|
|
944
967
|
this.created = created;
|
|
@@ -950,12 +973,30 @@ class News {
|
|
|
950
973
|
this.ingress = ingress;
|
|
951
974
|
this.news_image = news_image;
|
|
952
975
|
this.news_image_text = news_image_text;
|
|
953
|
-
this.original_height = original_height;
|
|
954
|
-
this.original_width = original_width;
|
|
955
976
|
this.published_date = published_date;
|
|
977
|
+
this.read = read;
|
|
978
|
+
this.show_on_my_pages = show_on_my_pages;
|
|
956
979
|
this.text = text;
|
|
957
980
|
this.title = title;
|
|
958
981
|
this.updated = updated;
|
|
982
|
+
this.urls = urls;
|
|
983
|
+
}
|
|
984
|
+
static asFormGroup(news = null) {
|
|
985
|
+
let show_on_my_pages = true;
|
|
986
|
+
if (typeof (news === null || news === void 0 ? void 0 : news.show_on_my_pages) !== 'undefined') {
|
|
987
|
+
show_on_my_pages = news.show_on_my_pages;
|
|
988
|
+
}
|
|
989
|
+
return new FormGroup({
|
|
990
|
+
id: new FormControl((news === null || news === void 0 ? void 0 : news.id) || ''),
|
|
991
|
+
active_to: new FormControl((news === null || news === void 0 ? void 0 : news.active_to) || ''),
|
|
992
|
+
ingress: new FormControl((news === null || news === void 0 ? void 0 : news.ingress) || '', [Validators.required, Validators.minLength(1)]),
|
|
993
|
+
news_image: new FormControl((news === null || news === void 0 ? void 0 : news.news_image) || ''),
|
|
994
|
+
news_image_text: new FormControl((news === null || news === void 0 ? void 0 : news.news_image_text) || ''),
|
|
995
|
+
published_date: new FormControl((news === null || news === void 0 ? void 0 : news.published_date) || ''),
|
|
996
|
+
show_on_my_pages: new FormControl(show_on_my_pages),
|
|
997
|
+
text: new FormControl((news === null || news === void 0 ? void 0 : news.text) || '', [Validators.required, Validators.minLength(1)]),
|
|
998
|
+
title: new FormControl((news === null || news === void 0 ? void 0 : news.title) || '', [Validators.required, Validators.minLength(1)])
|
|
999
|
+
});
|
|
959
1000
|
}
|
|
960
1001
|
}
|
|
961
1002
|
|
|
@@ -996,14 +1037,14 @@ class SearchMemberTeam {
|
|
|
996
1037
|
}
|
|
997
1038
|
}
|
|
998
1039
|
|
|
999
|
-
class
|
|
1040
|
+
class SearchTeam {
|
|
1000
1041
|
constructor(id, name) {
|
|
1001
1042
|
this.id = id;
|
|
1002
1043
|
this.name = name;
|
|
1003
1044
|
}
|
|
1004
1045
|
}
|
|
1005
1046
|
|
|
1006
|
-
class
|
|
1047
|
+
class Section {
|
|
1007
1048
|
constructor(id, name) {
|
|
1008
1049
|
this.id = id;
|
|
1009
1050
|
this.name = name;
|
|
@@ -1089,11 +1130,7 @@ class ApiService {
|
|
|
1089
1130
|
return this.get(role, path, pathParams, options).pipe(map((apiResource) => factory(apiResource)));
|
|
1090
1131
|
}
|
|
1091
1132
|
postFormData(factory, role, path, pathParams = {}, data) {
|
|
1092
|
-
|
|
1093
|
-
for (const [key, value] of Object.entries(data)) {
|
|
1094
|
-
body.append(key, value);
|
|
1095
|
-
}
|
|
1096
|
-
return this.http.post(this.url(this.path(role, path, pathParams)), body)
|
|
1133
|
+
return this.http.post(this.url(this.path(role, path, pathParams)), this.getFormData(data))
|
|
1097
1134
|
.pipe(map((apiResource) => factory(apiResource)));
|
|
1098
1135
|
}
|
|
1099
1136
|
postResource(factory, role, path, pathParams = {}, data, options = {}) {
|
|
@@ -1111,6 +1148,16 @@ class ApiService {
|
|
|
1111
1148
|
get(role, path, pathParams, options) {
|
|
1112
1149
|
return this.http.get(this.url(this.path(role, path, pathParams)), options);
|
|
1113
1150
|
}
|
|
1151
|
+
getFormData(data) {
|
|
1152
|
+
if (data instanceof FormData) {
|
|
1153
|
+
return data;
|
|
1154
|
+
}
|
|
1155
|
+
const formData = new FormData();
|
|
1156
|
+
for (const [key, value] of Object.entries(data)) {
|
|
1157
|
+
formData.append(key, value);
|
|
1158
|
+
}
|
|
1159
|
+
return formData;
|
|
1160
|
+
}
|
|
1114
1161
|
patch(role, path, pathParams, data, options) {
|
|
1115
1162
|
return this.http.patch(this.url(this.path(role, path, pathParams)), data, options);
|
|
1116
1163
|
}
|
|
@@ -1144,7 +1191,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.11", ngImpo
|
|
|
1144
1191
|
|
|
1145
1192
|
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);
|
|
1146
1193
|
|
|
1147
|
-
const memberAttributeFactory = (attribute) => new MemberAttribute(attribute.display_value, attribute.
|
|
1194
|
+
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);
|
|
1148
1195
|
|
|
1149
1196
|
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);
|
|
1150
1197
|
|
|
@@ -1160,13 +1207,13 @@ const memberFactory = (apiMember) => new Member(apiMember.id, apiMember.club_id,
|
|
|
1160
1207
|
const activityExtraMemberFactory = (apiActivityExtraMember) => new ActivityExtraMember(apiActivityExtraMember.id, apiActivityExtraMember.member_id, apiActivityExtraMember.team_id, apiActivityExtraMember.created, apiActivityExtraMember.leader, apiActivityExtraMember.member.birth_date ?
|
|
1161
1208
|
memberFactory(apiActivityExtraMember.member) : searchMemberFactory(apiActivityExtraMember.member), apiActivityExtraMember.member_name);
|
|
1162
1209
|
|
|
1163
|
-
const memberActivityInviteFactory = (invitedMember) => new MemberActivityInvite(invitedMember.id, invitedMember.comment, invitedMember.last_invite, invitedMember.leader, invitedMember.member_id, invitedMember.member_name, invitedMember.status);
|
|
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);
|
|
1164
1211
|
|
|
1165
1212
|
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);
|
|
1166
1213
|
|
|
1167
1214
|
const unpaidInvoiceFactory = (apiUnpaidInvoice) => new UnpaidMemberInvoice(apiUnpaidInvoice.id, apiUnpaidInvoice.club_bill_id, apiUnpaidInvoice.member_id, apiUnpaidInvoice.token);
|
|
1168
1215
|
|
|
1169
|
-
const activityInviteFactory = (apiActivityInvite) => new ActivityInvite(apiActivityInvite.id, activityFactory(apiActivityInvite.activity), apiActivityInvite.comment, apiActivityInvite.created, apiActivityInvite.has_unpaid_invoices, apiActivityInvite.last_invite, searchMemberFactory(apiActivityInvite.member), apiActivityInvite.reminded, apiActivityInvite.response_date, apiActivityInvite.status, apiActivityInvite.token, apiActivityInvite.unpaid_invoices && apiActivityInvite.unpaid_invoices.length ? apiActivityInvite.unpaid_invoices.map((apiUnpaidInvoice) => unpaidInvoiceFactory(apiUnpaidInvoice)) : [], apiActivityInvite.updated);
|
|
1216
|
+
const activityInviteFactory = (apiActivityInvite) => new ActivityInvite(apiActivityInvite.id, activityFactory(apiActivityInvite.activity), apiActivityInvite.comment, apiActivityInvite.created, apiActivityInvite.has_unpaid_invoices, apiActivityInvite.last_invite, searchMemberFactory(apiActivityInvite.member), apiActivityInvite.next_invite, apiActivityInvite.reminded, apiActivityInvite.response_date, apiActivityInvite.status, apiActivityInvite.token, apiActivityInvite.unpaid_invoices && apiActivityInvite.unpaid_invoices.length ? apiActivityInvite.unpaid_invoices.map((apiUnpaidInvoice) => unpaidInvoiceFactory(apiUnpaidInvoice)) : [], apiActivityInvite.updated);
|
|
1170
1217
|
|
|
1171
1218
|
const activityLocationFactory = (apiActivityLocation) => new ActivityLocation(apiActivityLocation.id, apiActivityLocation.club_id, apiActivityLocation.section_id, apiActivityLocation.active, apiActivityLocation.mun_location_city_area, apiActivityLocation.mun_location_name, apiActivityLocation.name);
|
|
1172
1219
|
|
|
@@ -1214,9 +1261,11 @@ const clubImageFactory = (apiClubImage) => new ClubImage(apiClubImage.club_id, a
|
|
|
1214
1261
|
|
|
1215
1262
|
const clubSectionFactory = (apiSection) => new ClubSection(apiSection.id, apiSection.name);
|
|
1216
1263
|
|
|
1264
|
+
const clubTeamFactory = (apiClubTeam) => new SearchTeam(apiClubTeam.id, apiClubTeam.name);
|
|
1265
|
+
|
|
1217
1266
|
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);
|
|
1218
1267
|
|
|
1219
|
-
const fileFactory = (file) => new FileObject(file.id, file.created, 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);
|
|
1268
|
+
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);
|
|
1220
1269
|
|
|
1221
1270
|
const directoryFactory = (directory) => new Directory(directory.id, directory.club_id, directory.section_id, directory.team_id, directory.created, directory.files.map((file) => fileFactory(file)), directory.name, directory.location_name, directory.updated);
|
|
1222
1271
|
|
|
@@ -1246,7 +1295,7 @@ const memberTeamFactory = (apiMemberTeam) => new MemberTeam(clubFactory(apiMembe
|
|
|
1246
1295
|
|
|
1247
1296
|
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);
|
|
1248
1297
|
|
|
1249
|
-
const newsFactory = (apiNews) => new News(apiNews.id, apiNews.club_id, apiNews.created, apiNews.created_by_id, apiNews.section_id, apiNews.team_id, apiNews.active_to, apiNews.author, apiNews.ingress, apiNews.news_image, apiNews.news_image_text, apiNews.
|
|
1298
|
+
const newsFactory = (apiNews) => new News(apiNews.id, apiNews.club_id, apiNews.created, apiNews.created_by_id, apiNews.section_id, apiNews.team_id, apiNews.active_to, apiNews.author, apiNews.ingress, apiNews.news_image, apiNews.news_image_text, apiNews.published_date, apiNews.read, apiNews.show_on_my_pages, apiNews.text, apiNews.title, apiNews.updated, apiNews.urls ? imageUrlsFactory(apiNews.urls) : null);
|
|
1250
1299
|
|
|
1251
1300
|
const paymentAttemptFactory = (apiPaymentAttempt) => {
|
|
1252
1301
|
let paymentAttemptData = null;
|
|
@@ -1272,7 +1321,7 @@ const paymentAttemptFactory = (apiPaymentAttempt) => {
|
|
|
1272
1321
|
|
|
1273
1322
|
const searchClubFactory = (apiSearchClub) => new SearchClub(apiSearchClub.id, apiSearchClub.leader_member_search, apiSearchClub.member_search, apiSearchClub.name);
|
|
1274
1323
|
|
|
1275
|
-
const searchMemberCardFactory = (apiSearchMemberCard) => new SearchMemberCard(apiSearchMemberCard.id, apiSearchMemberCard.name, apiSearchMemberCard.pdf_url);
|
|
1324
|
+
const searchMemberCardFactory = (apiSearchMemberCard) => new SearchMemberCard(apiSearchMemberCard.id, apiSearchMemberCard.name, apiSearchMemberCard.notification_count, apiSearchMemberCard.pdf_url);
|
|
1276
1325
|
|
|
1277
1326
|
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);
|
|
1278
1327
|
|
|
@@ -1280,6 +1329,8 @@ const searchMemberTeamFactory = (apiSearchMemberTeam) => new SearchMemberTeam(cl
|
|
|
1280
1329
|
|
|
1281
1330
|
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);
|
|
1282
1331
|
|
|
1332
|
+
const sectionTeamFactory = (apiSectionTeam) => new SearchTeam(apiSectionTeam.id, apiSectionTeam.name);
|
|
1333
|
+
|
|
1283
1334
|
const tokenFactory = (apiToken) => new Token(apiToken.access_token, apiToken.refresh_token);
|
|
1284
1335
|
|
|
1285
1336
|
const userFactory = (apiUser) => new User(apiUser.device_token, apiUser.email, apiUser.first_name, apiUser.is_staff, apiUser.language, apiUser.last_name, apiUser.new_email);
|
|
@@ -1341,6 +1392,8 @@ const MEMBER_CALENDAR_PATH = ':memberId/activities/calendar/';
|
|
|
1341
1392
|
const PUBLIC_ACTIVITY_INVITE_PATH = 'activities/:id/:token/';
|
|
1342
1393
|
const TEAM_ACTIVITIES_PATH = ':teamId/activities/';
|
|
1343
1394
|
const TEAM_ACTIVITY_INVITES_PATH = ':teamId/activities/:activityId/invites/';
|
|
1395
|
+
const TEAM_ACTIVITY_INVITE_PATH = ':teamId/activities/:activityId/invites/:activityInviteId/';
|
|
1396
|
+
const TEAM_ACTIVITY_INVITE_RESEND_PATH = ':teamId/activities/:activityId/invites/:activityInviteId/resend-invite/';
|
|
1344
1397
|
const TEAM_ACTIVITY_LOCATIONS_PATH = ':teamId/activities/locations/';
|
|
1345
1398
|
const TEAM_ACTIVITY_NEW_PATH = ':teamId/activities/new/';
|
|
1346
1399
|
const TEAM_ACTIVITY_PARTICIPANTS_PATH = ':teamId/activities/:activityId/participants/';
|
|
@@ -1365,7 +1418,7 @@ class ActivityService {
|
|
|
1365
1418
|
return this.apiService
|
|
1366
1419
|
.postResource(activityFactory, Role.TeamAdmin, TEAM_ACTIVITIES_PATH, {
|
|
1367
1420
|
teamId
|
|
1368
|
-
}, data);
|
|
1421
|
+
}, this.removeUnusedActivityFields(data));
|
|
1369
1422
|
}
|
|
1370
1423
|
deleteTeamActivity(teamId, id) {
|
|
1371
1424
|
return this.apiService
|
|
@@ -1374,6 +1427,14 @@ class ActivityService {
|
|
|
1374
1427
|
id
|
|
1375
1428
|
});
|
|
1376
1429
|
}
|
|
1430
|
+
deleteTeamActivityInvite(teamId, activityId, activityInviteId) {
|
|
1431
|
+
return this.apiService
|
|
1432
|
+
.deleteResource(Role.TeamAdmin, TEAM_ACTIVITY_INVITE_PATH, {
|
|
1433
|
+
teamId,
|
|
1434
|
+
activityId,
|
|
1435
|
+
activityInviteId
|
|
1436
|
+
});
|
|
1437
|
+
}
|
|
1377
1438
|
getMemberActivityInvite(memberId, activityInviteId) {
|
|
1378
1439
|
return this.apiService
|
|
1379
1440
|
.getResource(activityInviteFactory, Role.MemberAdmin, MEMBER_ACTIVITY_INVITE_PATH, {
|
|
@@ -1413,7 +1474,7 @@ class ActivityService {
|
|
|
1413
1474
|
.getResource(activityFactory, Role.TeamAdmin, TEAM_ACTIVITY_PATH, { teamId, id });
|
|
1414
1475
|
}
|
|
1415
1476
|
getTeamActivityLocations(teamId) {
|
|
1416
|
-
if (this.activityLocationResponseDate && this.activityLocationResponseDate >
|
|
1477
|
+
if (this.activityLocationResponseDate && this.activityLocationResponseDate > sub(new Date(), { hours: 1 })) {
|
|
1417
1478
|
return of(this.activityLocationCollection);
|
|
1418
1479
|
}
|
|
1419
1480
|
return this.apiService
|
|
@@ -1440,7 +1501,7 @@ class ActivityService {
|
|
|
1440
1501
|
});
|
|
1441
1502
|
}
|
|
1442
1503
|
getTeamActivityTypes(teamId) {
|
|
1443
|
-
if (this.activityTypeResponseDate && this.activityTypeResponseDate >
|
|
1504
|
+
if (this.activityTypeResponseDate && this.activityTypeResponseDate > sub(new Date(), { hours: 1 })) {
|
|
1444
1505
|
return of(this.activityTypeCollection);
|
|
1445
1506
|
}
|
|
1446
1507
|
return this.apiService
|
|
@@ -1462,6 +1523,14 @@ class ActivityService {
|
|
|
1462
1523
|
params
|
|
1463
1524
|
});
|
|
1464
1525
|
}
|
|
1526
|
+
resendInvite(teamId, activityId, activityInviteId) {
|
|
1527
|
+
return this.apiService
|
|
1528
|
+
.postResource(activityInviteFactory, Role.TeamAdmin, TEAM_ACTIVITY_INVITE_RESEND_PATH, {
|
|
1529
|
+
teamId,
|
|
1530
|
+
activityId,
|
|
1531
|
+
activityInviteId
|
|
1532
|
+
}, {});
|
|
1533
|
+
}
|
|
1465
1534
|
updateMemberActivity(memberId, activityInviteId, activityInvite) {
|
|
1466
1535
|
return this.apiService
|
|
1467
1536
|
.updateResource(activityInviteFactory, Role.MemberAdmin, MEMBER_ACTIVITY_INVITE_PATH, {
|
|
@@ -1481,7 +1550,15 @@ class ActivityService {
|
|
|
1481
1550
|
.updateResource(activityFactory, Role.TeamAdmin, TEAM_ACTIVITY_PATH, {
|
|
1482
1551
|
teamId,
|
|
1483
1552
|
id: activity.id
|
|
1484
|
-
}, activity);
|
|
1553
|
+
}, this.removeUnusedActivityFields(activity));
|
|
1554
|
+
}
|
|
1555
|
+
updateTeamActivityInvite(teamId, activityId, activityInviteId, activityInvite) {
|
|
1556
|
+
return this.apiService
|
|
1557
|
+
.updateResource(memberActivityInviteFactory, Role.TeamAdmin, TEAM_ACTIVITY_INVITE_PATH, {
|
|
1558
|
+
teamId,
|
|
1559
|
+
activityId,
|
|
1560
|
+
activityInviteId
|
|
1561
|
+
}, activityInvite);
|
|
1485
1562
|
}
|
|
1486
1563
|
updateTeamActivityParticipants(teamId, activityId, members) {
|
|
1487
1564
|
return this.apiService
|
|
@@ -1492,9 +1569,17 @@ class ActivityService {
|
|
|
1492
1569
|
members
|
|
1493
1570
|
});
|
|
1494
1571
|
}
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1572
|
+
removeUnusedActivityFields(activity) {
|
|
1573
|
+
if (typeof activity.id !== 'undefined') {
|
|
1574
|
+
delete activity.id;
|
|
1575
|
+
}
|
|
1576
|
+
if (typeof activity.file !== 'undefined' && !activity.file) {
|
|
1577
|
+
delete activity.file;
|
|
1578
|
+
}
|
|
1579
|
+
if (typeof activity.invite_last_response_date !== 'undefined' && !activity.invite_last_response_date) {
|
|
1580
|
+
delete activity.invite_last_response_date;
|
|
1581
|
+
}
|
|
1582
|
+
return activity;
|
|
1498
1583
|
}
|
|
1499
1584
|
}
|
|
1500
1585
|
ActivityService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: ActivityService, deps: [{ token: ApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
@@ -1724,11 +1809,46 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.11", ngImpo
|
|
|
1724
1809
|
}], ctorParameters: function () { return [{ type: ApiService }]; } });
|
|
1725
1810
|
|
|
1726
1811
|
const MEMBER_DIRECTORIES_PATH = ':memberId/files/';
|
|
1727
|
-
const TEAM_DIRECTORIES_PATH = ':teamId/
|
|
1812
|
+
const TEAM_DIRECTORIES_PATH = ':teamId/directories/';
|
|
1813
|
+
const TEAM_DIRECTORY_PATH = ':teamId/directories/:directoryId/';
|
|
1814
|
+
const TEAM_FILES_PATH = ':teamId/directories/:directoryId/files/';
|
|
1815
|
+
const TEAM_FILE_PATH = ':teamId/directories/:directoryId/files/:fileId/';
|
|
1728
1816
|
class FileService {
|
|
1729
1817
|
constructor(apiService) {
|
|
1730
1818
|
this.apiService = apiService;
|
|
1731
1819
|
}
|
|
1820
|
+
createTeamDirectory(teamId, directory) {
|
|
1821
|
+
return this.apiService
|
|
1822
|
+
.postResource(directoryFactory, Role.TeamAdmin, TEAM_DIRECTORIES_PATH, {
|
|
1823
|
+
teamId
|
|
1824
|
+
}, directory);
|
|
1825
|
+
}
|
|
1826
|
+
createTeamFile(teamId, directoryId, file) {
|
|
1827
|
+
const formData = new FormData();
|
|
1828
|
+
const fileObj = file.file;
|
|
1829
|
+
formData.append('name', file.name);
|
|
1830
|
+
formData.append('file', fileObj, fileObj.name);
|
|
1831
|
+
return this.apiService
|
|
1832
|
+
.postFormData(fileFactory, Role.TeamAdmin, TEAM_FILES_PATH, {
|
|
1833
|
+
teamId,
|
|
1834
|
+
directoryId
|
|
1835
|
+
}, formData);
|
|
1836
|
+
}
|
|
1837
|
+
deleteTeamDirectory(teamId, directoryId) {
|
|
1838
|
+
return this.apiService
|
|
1839
|
+
.deleteResource(Role.TeamAdmin, TEAM_DIRECTORY_PATH, {
|
|
1840
|
+
teamId,
|
|
1841
|
+
directoryId
|
|
1842
|
+
});
|
|
1843
|
+
}
|
|
1844
|
+
deleteTeamFile(teamId, directoryId, fileId) {
|
|
1845
|
+
return this.apiService
|
|
1846
|
+
.deleteResource(Role.TeamAdmin, TEAM_FILE_PATH, {
|
|
1847
|
+
teamId,
|
|
1848
|
+
directoryId,
|
|
1849
|
+
fileId
|
|
1850
|
+
});
|
|
1851
|
+
}
|
|
1732
1852
|
getMemberDirectories(memberId) {
|
|
1733
1853
|
return this.apiService
|
|
1734
1854
|
.getCollection(directoryFactory, Role.MemberAdmin, MEMBER_DIRECTORIES_PATH, { memberId }, { params: { limit: 'null' } });
|
|
@@ -1984,14 +2104,55 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.11", ngImpo
|
|
|
1984
2104
|
}]
|
|
1985
2105
|
}], ctorParameters: function () { return [{ type: ApiService }]; } });
|
|
1986
2106
|
|
|
1987
|
-
const
|
|
2107
|
+
const MEMBER_NEWS_ITEMS_PATH = ':memberId/news/';
|
|
2108
|
+
const MEMBER_NEWS_ITEM_PATH = ':memberId/news/:id/';
|
|
2109
|
+
const TEAM_NEWS_ITEMS_PATH = ':teamId/news/';
|
|
2110
|
+
const TEAM_NEWS_ITEM_PATH = ':teamId/news/:id/';
|
|
1988
2111
|
class NewsService {
|
|
1989
2112
|
constructor(apiService) {
|
|
1990
2113
|
this.apiService = apiService;
|
|
1991
2114
|
}
|
|
2115
|
+
createTeamNews(teamId, news) {
|
|
2116
|
+
delete news.id;
|
|
2117
|
+
return this.apiService
|
|
2118
|
+
.postFormData(newsFactory, Role.TeamAdmin, TEAM_NEWS_ITEMS_PATH, {
|
|
2119
|
+
teamId
|
|
2120
|
+
}, this.createFormData(news));
|
|
2121
|
+
}
|
|
2122
|
+
deleteTeamNews(teamId, id) {
|
|
2123
|
+
return this.apiService
|
|
2124
|
+
.deleteResource(Role.TeamAdmin, TEAM_NEWS_ITEM_PATH, {
|
|
2125
|
+
teamId,
|
|
2126
|
+
id
|
|
2127
|
+
});
|
|
2128
|
+
}
|
|
2129
|
+
getMemberNews(memberId, id) {
|
|
2130
|
+
return this.apiService
|
|
2131
|
+
.getResource(newsFactory, Role.MemberAdmin, MEMBER_NEWS_ITEM_PATH, {
|
|
2132
|
+
memberId,
|
|
2133
|
+
id
|
|
2134
|
+
});
|
|
2135
|
+
}
|
|
2136
|
+
getTeamNews(teamId, id) {
|
|
2137
|
+
return this.apiService
|
|
2138
|
+
.getResource(newsFactory, Role.TeamAdmin, TEAM_NEWS_ITEM_PATH, {
|
|
2139
|
+
teamId,
|
|
2140
|
+
id
|
|
2141
|
+
});
|
|
2142
|
+
}
|
|
2143
|
+
listMemberNews(memberId, offset) {
|
|
2144
|
+
return this.apiService
|
|
2145
|
+
.getCollection(newsFactory, Role.MemberAdmin, MEMBER_NEWS_ITEMS_PATH, {
|
|
2146
|
+
memberId
|
|
2147
|
+
}, {
|
|
2148
|
+
params: {
|
|
2149
|
+
offset: offset.toString(10)
|
|
2150
|
+
}
|
|
2151
|
+
});
|
|
2152
|
+
}
|
|
1992
2153
|
listTeamNews(teamId, offset) {
|
|
1993
2154
|
return this.apiService
|
|
1994
|
-
.getCollection(newsFactory, Role.TeamAdmin,
|
|
2155
|
+
.getCollection(newsFactory, Role.TeamAdmin, TEAM_NEWS_ITEMS_PATH, {
|
|
1995
2156
|
teamId
|
|
1996
2157
|
}, {
|
|
1997
2158
|
params: {
|
|
@@ -1999,6 +2160,36 @@ class NewsService {
|
|
|
1999
2160
|
}
|
|
2000
2161
|
});
|
|
2001
2162
|
}
|
|
2163
|
+
updateTeamNews(teamId, id, news) {
|
|
2164
|
+
return this.apiService
|
|
2165
|
+
.postFormData(newsFactory, Role.TeamAdmin, TEAM_NEWS_ITEM_PATH, {
|
|
2166
|
+
teamId,
|
|
2167
|
+
id
|
|
2168
|
+
}, this.createFormData(news));
|
|
2169
|
+
}
|
|
2170
|
+
createFormData(news) {
|
|
2171
|
+
const formData = new FormData();
|
|
2172
|
+
if (!news.active_to) {
|
|
2173
|
+
news.active_to = null;
|
|
2174
|
+
}
|
|
2175
|
+
if (!news.news_image) {
|
|
2176
|
+
news.news_image = new File([], '');
|
|
2177
|
+
}
|
|
2178
|
+
if (!news.published_date) {
|
|
2179
|
+
news.published_date = null;
|
|
2180
|
+
}
|
|
2181
|
+
formData.append('title', news === null || news === void 0 ? void 0 : news.title);
|
|
2182
|
+
formData.append('ingress', news === null || news === void 0 ? void 0 : news.ingress);
|
|
2183
|
+
formData.append('text', news === null || news === void 0 ? void 0 : news.text);
|
|
2184
|
+
if (typeof (news === null || news === void 0 ? void 0 : news.news_image) !== 'undefined' && (news === null || news === void 0 ? void 0 : news.news_image) instanceof File) {
|
|
2185
|
+
formData.append('news_image', news === null || news === void 0 ? void 0 : news.news_image);
|
|
2186
|
+
}
|
|
2187
|
+
formData.append('news_image_text', news === null || news === void 0 ? void 0 : news.news_image_text);
|
|
2188
|
+
formData.append('published_date', (news === null || news === void 0 ? void 0 : news.published_date) ? news === null || news === void 0 ? void 0 : news.published_date : '');
|
|
2189
|
+
formData.append('active_to', (news === null || news === void 0 ? void 0 : news.active_to) ? news === null || news === void 0 ? void 0 : news.active_to : '');
|
|
2190
|
+
formData.append('show_on_my_pages', `${(news === null || news === void 0 ? void 0 : news.show_on_my_pages) || false}`);
|
|
2191
|
+
return formData;
|
|
2192
|
+
}
|
|
2002
2193
|
}
|
|
2003
2194
|
NewsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: NewsService, deps: [{ token: ApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2004
2195
|
NewsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: NewsService, providedIn: 'root' });
|
|
@@ -2027,7 +2218,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.11", ngImpo
|
|
|
2027
2218
|
}]
|
|
2028
2219
|
}], ctorParameters: function () { return [{ type: ApiService }]; } });
|
|
2029
2220
|
|
|
2030
|
-
const CLUB_TEAMS_PATH = '
|
|
2221
|
+
const CLUB_TEAMS_PATH = ':clubId/teams/';
|
|
2031
2222
|
const MEMBER_TEAM_MEMBER_PATH = ':memberId/teams/:teamId/team-members/:id/';
|
|
2032
2223
|
const MEMBER_TEAM_MEMBERS_PATH = ':memberId/teams/:teamId/team-members/';
|
|
2033
2224
|
const MEMBER_TEAM_EXTRA_MEMBER_PATH = ':memberId/teams/:teamId/extra-members/:id/';
|
|
@@ -2048,7 +2239,7 @@ class TeamService {
|
|
|
2048
2239
|
return this.apiService.deleteResource(Role.TeamAdmin, TEAM_LEADER_TEAM_MEMBER_PATH, { teamId, id });
|
|
2049
2240
|
}
|
|
2050
2241
|
getClubTeams(clubId) {
|
|
2051
|
-
return this.apiService.getCollection(
|
|
2242
|
+
return this.apiService.getCollection(clubTeamFactory, Role.ClubAdmin, CLUB_TEAMS_PATH, { clubId });
|
|
2052
2243
|
}
|
|
2053
2244
|
getMemberTeam(memberId, teamId) {
|
|
2054
2245
|
return this.apiService.getResource(memberTeamFactory, Role.MemberAdmin, MEMBER_TEAM_PATH, { memberId, teamId });
|
|
@@ -2069,7 +2260,7 @@ class TeamService {
|
|
|
2069
2260
|
return this.apiService.getCollection(searchMemberTeamFactory, Role.MemberAdmin, MEMBER_TEAMS_PATH, { memberId });
|
|
2070
2261
|
}
|
|
2071
2262
|
getSectionTeams(role, sectionId) {
|
|
2072
|
-
return this.apiService.getCollection(
|
|
2263
|
+
return this.apiService.getCollection(sectionTeamFactory, role, SECTION_TEAMS_PATH, { sectionId });
|
|
2073
2264
|
}
|
|
2074
2265
|
getTeamLeaderTeam(teamId) {
|
|
2075
2266
|
return this.apiService.getResource(memberTeamFactory, Role.TeamAdmin, TEAM_LEADER_TEAM_PATH, { teamId });
|
|
@@ -2129,7 +2320,7 @@ class TokenService {
|
|
|
2129
2320
|
if (err.status === 401) {
|
|
2130
2321
|
return of(null);
|
|
2131
2322
|
}
|
|
2132
|
-
return throwError(err);
|
|
2323
|
+
return throwError(() => err);
|
|
2133
2324
|
}));
|
|
2134
2325
|
}
|
|
2135
2326
|
logout() {
|
|
@@ -2299,6 +2490,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.11", ngImpo
|
|
|
2299
2490
|
class AuthenticationInterceptor {
|
|
2300
2491
|
constructor(authenticationService) {
|
|
2301
2492
|
this.authenticationService = authenticationService;
|
|
2493
|
+
this.isRefreshing = false;
|
|
2494
|
+
this.refreshTokenSubject = new BehaviorSubject(null);
|
|
2302
2495
|
}
|
|
2303
2496
|
intercept(request, next) {
|
|
2304
2497
|
const authentication = this.authenticationService.authentication;
|
|
@@ -2307,16 +2500,9 @@ class AuthenticationInterceptor {
|
|
|
2307
2500
|
}
|
|
2308
2501
|
return next.handle(request).pipe(catchError((requestError) => {
|
|
2309
2502
|
if (requestError instanceof HttpErrorResponse && requestError.status === 401) {
|
|
2310
|
-
|
|
2311
|
-
return this.authenticationService.reauthenticate().pipe(mergeMap((token) => {
|
|
2312
|
-
if (token && token.accessToken) {
|
|
2313
|
-
return next.handle(this.addAuthorizationHeader(request, token.accessToken));
|
|
2314
|
-
}
|
|
2315
|
-
return throwError(requestError);
|
|
2316
|
-
}));
|
|
2317
|
-
}
|
|
2503
|
+
return this.handle401Error(request, next);
|
|
2318
2504
|
}
|
|
2319
|
-
return throwError(requestError);
|
|
2505
|
+
return throwError(() => requestError);
|
|
2320
2506
|
}));
|
|
2321
2507
|
}
|
|
2322
2508
|
addAuthorizationHeader(request, token) {
|
|
@@ -2327,11 +2513,34 @@ class AuthenticationInterceptor {
|
|
|
2327
2513
|
}
|
|
2328
2514
|
return request;
|
|
2329
2515
|
}
|
|
2516
|
+
handle401Error(request, next) {
|
|
2517
|
+
if (this.isRefreshing) {
|
|
2518
|
+
return this.refreshTokenSubject
|
|
2519
|
+
.pipe(filter(token => token !== null), take(1), switchMap((token) => next.handle(this.addAuthorizationHeader(request, token === null || token === void 0 ? void 0 : token.accessToken))));
|
|
2520
|
+
}
|
|
2521
|
+
else {
|
|
2522
|
+
this.isRefreshing = true;
|
|
2523
|
+
this.refreshTokenSubject.next(null);
|
|
2524
|
+
return this.authenticationService.reauthenticate()
|
|
2525
|
+
.pipe(catchError((err) => {
|
|
2526
|
+
this.isRefreshing = false;
|
|
2527
|
+
this.authenticationService.clearAuthentication();
|
|
2528
|
+
return throwError(() => err);
|
|
2529
|
+
}), switchMap((token) => {
|
|
2530
|
+
this.refreshTokenSubject.next(token);
|
|
2531
|
+
this.isRefreshing = false;
|
|
2532
|
+
return next.handle(this.addAuthorizationHeader(request, token.accessToken));
|
|
2533
|
+
}));
|
|
2534
|
+
}
|
|
2535
|
+
}
|
|
2330
2536
|
}
|
|
2331
2537
|
AuthenticationInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: AuthenticationInterceptor, deps: [{ token: AuthenticationService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2332
|
-
AuthenticationInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: AuthenticationInterceptor });
|
|
2538
|
+
AuthenticationInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: AuthenticationInterceptor, providedIn: 'root' });
|
|
2333
2539
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: AuthenticationInterceptor, decorators: [{
|
|
2334
|
-
type: Injectable
|
|
2540
|
+
type: Injectable,
|
|
2541
|
+
args: [{
|
|
2542
|
+
providedIn: 'root'
|
|
2543
|
+
}]
|
|
2335
2544
|
}], ctorParameters: function () { return [{ type: AuthenticationService }]; } });
|
|
2336
2545
|
|
|
2337
2546
|
const REDIRECT_PARAM_NAME = 'next';
|
|
@@ -2398,18 +2607,18 @@ class DataAccessModule {
|
|
|
2398
2607
|
providers: [
|
|
2399
2608
|
{ provide: APP, useValue: config.app },
|
|
2400
2609
|
{ provide: DOMAIN, useValue: config.domain },
|
|
2401
|
-
{ provide: HTTP_INTERCEPTORS,
|
|
2610
|
+
{ provide: HTTP_INTERCEPTORS, useExisting: AuthenticationInterceptor, multi: true }
|
|
2402
2611
|
]
|
|
2403
2612
|
};
|
|
2404
2613
|
}
|
|
2405
2614
|
}
|
|
2406
2615
|
DataAccessModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: DataAccessModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2407
|
-
DataAccessModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.11", ngImport: i0, type: DataAccessModule
|
|
2408
|
-
DataAccessModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: DataAccessModule
|
|
2616
|
+
DataAccessModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.11", ngImport: i0, type: DataAccessModule });
|
|
2617
|
+
DataAccessModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: DataAccessModule });
|
|
2409
2618
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: DataAccessModule, decorators: [{
|
|
2410
2619
|
type: NgModule,
|
|
2411
2620
|
args: [{
|
|
2412
|
-
imports: [
|
|
2621
|
+
imports: [] // TODO: Check if this is required
|
|
2413
2622
|
}]
|
|
2414
2623
|
}] });
|
|
2415
2624
|
|
|
@@ -2421,5 +2630,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.11", ngImpo
|
|
|
2421
2630
|
* Generated bundle index. Do not edit.
|
|
2422
2631
|
*/
|
|
2423
2632
|
|
|
2424
|
-
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, Section, SectionService,
|
|
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 };
|
|
2425
2634
|
//# sourceMappingURL=myclub_se-data-access.mjs.map
|