@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?.invite_settings || ''),
|
|
80
80
|
last_response_date: new FormControl(activity?.last_response_date || ''),
|
|
81
81
|
max_num_attendants: new FormControl(activity?.max_num_attendants || 0),
|
|
82
|
+
max_num_attendants_type: new FormControl(activity?.max_num_attendants_type || 'only_participants'),
|
|
82
83
|
meet_up_place: new FormControl(activity?.meet_up_place || ''),
|
|
83
84
|
meet_up_time: new FormControl(activity?.meet_up_time || 0),
|
|
84
85
|
repeat: new FormControl(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,19 @@ class MemberAttribute {
|
|
|
797
807
|
this.value = value;
|
|
798
808
|
}
|
|
799
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
|
+
})) || []);
|
|
800
814
|
return new FormGroup({
|
|
801
815
|
field_id: new FormControl(attribute?.field_id || ''),
|
|
802
816
|
member_id: new FormControl(attribute?.member_id || ''),
|
|
803
|
-
|
|
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 || '')
|
|
804
823
|
});
|
|
805
824
|
}
|
|
806
825
|
}
|
|
@@ -876,13 +895,16 @@ class SearchMember {
|
|
|
876
895
|
}
|
|
877
896
|
|
|
878
897
|
class MemberActivityInvite {
|
|
879
|
-
constructor(id, comment, last_invite, leader, member_id, member_name, status) {
|
|
898
|
+
constructor(id, comment, last_invite, leader, member_email, member_id, member_name, next_invite, response_date, status) {
|
|
880
899
|
this.id = id;
|
|
881
900
|
this.comment = comment;
|
|
882
901
|
this.last_invite = last_invite;
|
|
883
902
|
this.leader = leader;
|
|
903
|
+
this.member_email = member_email;
|
|
884
904
|
this.member_id = member_id;
|
|
885
905
|
this.member_name = member_name;
|
|
906
|
+
this.next_invite = next_invite;
|
|
907
|
+
this.response_date = response_date;
|
|
886
908
|
this.status = status;
|
|
887
909
|
}
|
|
888
910
|
getColorByStatus() {
|
|
@@ -938,7 +960,7 @@ class MemberTeamThrough {
|
|
|
938
960
|
}
|
|
939
961
|
|
|
940
962
|
class News {
|
|
941
|
-
constructor(id, club_id, created, created_by_id, section_id, team_id, active_to, author, ingress, news_image, news_image_text,
|
|
963
|
+
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
964
|
this.id = id;
|
|
943
965
|
this.club_id = club_id;
|
|
944
966
|
this.created = created;
|
|
@@ -950,12 +972,30 @@ class News {
|
|
|
950
972
|
this.ingress = ingress;
|
|
951
973
|
this.news_image = news_image;
|
|
952
974
|
this.news_image_text = news_image_text;
|
|
953
|
-
this.original_height = original_height;
|
|
954
|
-
this.original_width = original_width;
|
|
955
975
|
this.published_date = published_date;
|
|
976
|
+
this.read = read;
|
|
977
|
+
this.show_on_my_pages = show_on_my_pages;
|
|
956
978
|
this.text = text;
|
|
957
979
|
this.title = title;
|
|
958
980
|
this.updated = updated;
|
|
981
|
+
this.urls = urls;
|
|
982
|
+
}
|
|
983
|
+
static asFormGroup(news = null) {
|
|
984
|
+
let show_on_my_pages = true;
|
|
985
|
+
if (typeof news?.show_on_my_pages !== 'undefined') {
|
|
986
|
+
show_on_my_pages = news.show_on_my_pages;
|
|
987
|
+
}
|
|
988
|
+
return new FormGroup({
|
|
989
|
+
id: new FormControl(news?.id || ''),
|
|
990
|
+
active_to: new FormControl(news?.active_to || ''),
|
|
991
|
+
ingress: new FormControl(news?.ingress || '', [Validators.required, Validators.minLength(1)]),
|
|
992
|
+
news_image: new FormControl(news?.news_image || ''),
|
|
993
|
+
news_image_text: new FormControl(news?.news_image_text || ''),
|
|
994
|
+
published_date: new FormControl(news?.published_date || ''),
|
|
995
|
+
show_on_my_pages: new FormControl(show_on_my_pages),
|
|
996
|
+
text: new FormControl(news?.text || '', [Validators.required, Validators.minLength(1)]),
|
|
997
|
+
title: new FormControl(news?.title || '', [Validators.required, Validators.minLength(1)])
|
|
998
|
+
});
|
|
959
999
|
}
|
|
960
1000
|
}
|
|
961
1001
|
|
|
@@ -996,14 +1036,14 @@ class SearchMemberTeam {
|
|
|
996
1036
|
}
|
|
997
1037
|
}
|
|
998
1038
|
|
|
999
|
-
class
|
|
1039
|
+
class SearchTeam {
|
|
1000
1040
|
constructor(id, name) {
|
|
1001
1041
|
this.id = id;
|
|
1002
1042
|
this.name = name;
|
|
1003
1043
|
}
|
|
1004
1044
|
}
|
|
1005
1045
|
|
|
1006
|
-
class
|
|
1046
|
+
class Section {
|
|
1007
1047
|
constructor(id, name) {
|
|
1008
1048
|
this.id = id;
|
|
1009
1049
|
this.name = name;
|
|
@@ -1089,11 +1129,7 @@ class ApiService {
|
|
|
1089
1129
|
return this.get(role, path, pathParams, options).pipe(map((apiResource) => factory(apiResource)));
|
|
1090
1130
|
}
|
|
1091
1131
|
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)
|
|
1132
|
+
return this.http.post(this.url(this.path(role, path, pathParams)), this.getFormData(data))
|
|
1097
1133
|
.pipe(map((apiResource) => factory(apiResource)));
|
|
1098
1134
|
}
|
|
1099
1135
|
postResource(factory, role, path, pathParams = {}, data, options = {}) {
|
|
@@ -1111,6 +1147,16 @@ class ApiService {
|
|
|
1111
1147
|
get(role, path, pathParams, options) {
|
|
1112
1148
|
return this.http.get(this.url(this.path(role, path, pathParams)), options);
|
|
1113
1149
|
}
|
|
1150
|
+
getFormData(data) {
|
|
1151
|
+
if (data instanceof FormData) {
|
|
1152
|
+
return data;
|
|
1153
|
+
}
|
|
1154
|
+
const formData = new FormData();
|
|
1155
|
+
for (const [key, value] of Object.entries(data)) {
|
|
1156
|
+
formData.append(key, value);
|
|
1157
|
+
}
|
|
1158
|
+
return formData;
|
|
1159
|
+
}
|
|
1114
1160
|
patch(role, path, pathParams, data, options) {
|
|
1115
1161
|
return this.http.patch(this.url(this.path(role, path, pathParams)), data, options);
|
|
1116
1162
|
}
|
|
@@ -1142,7 +1188,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.11", ngImpo
|
|
|
1142
1188
|
|
|
1143
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);
|
|
1144
1190
|
|
|
1145
|
-
const memberAttributeFactory = (attribute) => new MemberAttribute(attribute.display_value, attribute.
|
|
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);
|
|
1146
1192
|
|
|
1147
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);
|
|
1148
1194
|
|
|
@@ -1158,13 +1204,13 @@ const memberFactory = (apiMember) => new Member(apiMember.id, apiMember.club_id,
|
|
|
1158
1204
|
const activityExtraMemberFactory = (apiActivityExtraMember) => new ActivityExtraMember(apiActivityExtraMember.id, apiActivityExtraMember.member_id, apiActivityExtraMember.team_id, apiActivityExtraMember.created, apiActivityExtraMember.leader, apiActivityExtraMember.member.birth_date ?
|
|
1159
1205
|
memberFactory(apiActivityExtraMember.member) : searchMemberFactory(apiActivityExtraMember.member), apiActivityExtraMember.member_name);
|
|
1160
1206
|
|
|
1161
|
-
const memberActivityInviteFactory = (invitedMember) => new MemberActivityInvite(invitedMember.id, invitedMember.comment, invitedMember.last_invite, invitedMember.leader, invitedMember.member_id, invitedMember.member_name, invitedMember.status);
|
|
1207
|
+
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);
|
|
1162
1208
|
|
|
1163
1209
|
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);
|
|
1164
1210
|
|
|
1165
1211
|
const unpaidInvoiceFactory = (apiUnpaidInvoice) => new UnpaidMemberInvoice(apiUnpaidInvoice.id, apiUnpaidInvoice.club_bill_id, apiUnpaidInvoice.member_id, apiUnpaidInvoice.token);
|
|
1166
1212
|
|
|
1167
|
-
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);
|
|
1213
|
+
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);
|
|
1168
1214
|
|
|
1169
1215
|
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);
|
|
1170
1216
|
|
|
@@ -1212,9 +1258,11 @@ const clubImageFactory = (apiClubImage) => new ClubImage(apiClubImage.club_id, a
|
|
|
1212
1258
|
|
|
1213
1259
|
const clubSectionFactory = (apiSection) => new ClubSection(apiSection.id, apiSection.name);
|
|
1214
1260
|
|
|
1261
|
+
const clubTeamFactory = (apiClubTeam) => new SearchTeam(apiClubTeam.id, apiClubTeam.name);
|
|
1262
|
+
|
|
1215
1263
|
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);
|
|
1216
1264
|
|
|
1217
|
-
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);
|
|
1265
|
+
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);
|
|
1218
1266
|
|
|
1219
1267
|
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);
|
|
1220
1268
|
|
|
@@ -1244,7 +1292,7 @@ const memberTeamFactory = (apiMemberTeam) => new MemberTeam(clubFactory(apiMembe
|
|
|
1244
1292
|
|
|
1245
1293
|
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);
|
|
1246
1294
|
|
|
1247
|
-
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.
|
|
1295
|
+
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);
|
|
1248
1296
|
|
|
1249
1297
|
const paymentAttemptFactory = (apiPaymentAttempt) => {
|
|
1250
1298
|
let paymentAttemptData = null;
|
|
@@ -1270,7 +1318,7 @@ const paymentAttemptFactory = (apiPaymentAttempt) => {
|
|
|
1270
1318
|
|
|
1271
1319
|
const searchClubFactory = (apiSearchClub) => new SearchClub(apiSearchClub.id, apiSearchClub.leader_member_search, apiSearchClub.member_search, apiSearchClub.name);
|
|
1272
1320
|
|
|
1273
|
-
const searchMemberCardFactory = (apiSearchMemberCard) => new SearchMemberCard(apiSearchMemberCard.id, apiSearchMemberCard.name, apiSearchMemberCard.pdf_url);
|
|
1321
|
+
const searchMemberCardFactory = (apiSearchMemberCard) => new SearchMemberCard(apiSearchMemberCard.id, apiSearchMemberCard.name, apiSearchMemberCard.notification_count, apiSearchMemberCard.pdf_url);
|
|
1274
1322
|
|
|
1275
1323
|
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);
|
|
1276
1324
|
|
|
@@ -1278,6 +1326,8 @@ const searchMemberTeamFactory = (apiSearchMemberTeam) => new SearchMemberTeam(cl
|
|
|
1278
1326
|
|
|
1279
1327
|
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);
|
|
1280
1328
|
|
|
1329
|
+
const sectionTeamFactory = (apiSectionTeam) => new SearchTeam(apiSectionTeam.id, apiSectionTeam.name);
|
|
1330
|
+
|
|
1281
1331
|
const tokenFactory = (apiToken) => new Token(apiToken.access_token, apiToken.refresh_token);
|
|
1282
1332
|
|
|
1283
1333
|
const userFactory = (apiUser) => new User(apiUser.device_token, apiUser.email, apiUser.first_name, apiUser.is_staff, apiUser.language, apiUser.last_name, apiUser.new_email);
|
|
@@ -1339,6 +1389,8 @@ const MEMBER_CALENDAR_PATH = ':memberId/activities/calendar/';
|
|
|
1339
1389
|
const PUBLIC_ACTIVITY_INVITE_PATH = 'activities/:id/:token/';
|
|
1340
1390
|
const TEAM_ACTIVITIES_PATH = ':teamId/activities/';
|
|
1341
1391
|
const TEAM_ACTIVITY_INVITES_PATH = ':teamId/activities/:activityId/invites/';
|
|
1392
|
+
const TEAM_ACTIVITY_INVITE_PATH = ':teamId/activities/:activityId/invites/:activityInviteId/';
|
|
1393
|
+
const TEAM_ACTIVITY_INVITE_RESEND_PATH = ':teamId/activities/:activityId/invites/:activityInviteId/resend-invite/';
|
|
1342
1394
|
const TEAM_ACTIVITY_LOCATIONS_PATH = ':teamId/activities/locations/';
|
|
1343
1395
|
const TEAM_ACTIVITY_NEW_PATH = ':teamId/activities/new/';
|
|
1344
1396
|
const TEAM_ACTIVITY_PARTICIPANTS_PATH = ':teamId/activities/:activityId/participants/';
|
|
@@ -1363,7 +1415,7 @@ class ActivityService {
|
|
|
1363
1415
|
return this.apiService
|
|
1364
1416
|
.postResource(activityFactory, Role.TeamAdmin, TEAM_ACTIVITIES_PATH, {
|
|
1365
1417
|
teamId
|
|
1366
|
-
}, data);
|
|
1418
|
+
}, this.removeUnusedActivityFields(data));
|
|
1367
1419
|
}
|
|
1368
1420
|
deleteTeamActivity(teamId, id) {
|
|
1369
1421
|
return this.apiService
|
|
@@ -1372,6 +1424,14 @@ class ActivityService {
|
|
|
1372
1424
|
id
|
|
1373
1425
|
});
|
|
1374
1426
|
}
|
|
1427
|
+
deleteTeamActivityInvite(teamId, activityId, activityInviteId) {
|
|
1428
|
+
return this.apiService
|
|
1429
|
+
.deleteResource(Role.TeamAdmin, TEAM_ACTIVITY_INVITE_PATH, {
|
|
1430
|
+
teamId,
|
|
1431
|
+
activityId,
|
|
1432
|
+
activityInviteId
|
|
1433
|
+
});
|
|
1434
|
+
}
|
|
1375
1435
|
getMemberActivityInvite(memberId, activityInviteId) {
|
|
1376
1436
|
return this.apiService
|
|
1377
1437
|
.getResource(activityInviteFactory, Role.MemberAdmin, MEMBER_ACTIVITY_INVITE_PATH, {
|
|
@@ -1411,7 +1471,7 @@ class ActivityService {
|
|
|
1411
1471
|
.getResource(activityFactory, Role.TeamAdmin, TEAM_ACTIVITY_PATH, { teamId, id });
|
|
1412
1472
|
}
|
|
1413
1473
|
getTeamActivityLocations(teamId) {
|
|
1414
|
-
if (this.activityLocationResponseDate && this.activityLocationResponseDate >
|
|
1474
|
+
if (this.activityLocationResponseDate && this.activityLocationResponseDate > sub(new Date(), { hours: 1 })) {
|
|
1415
1475
|
return of(this.activityLocationCollection);
|
|
1416
1476
|
}
|
|
1417
1477
|
return this.apiService
|
|
@@ -1438,7 +1498,7 @@ class ActivityService {
|
|
|
1438
1498
|
});
|
|
1439
1499
|
}
|
|
1440
1500
|
getTeamActivityTypes(teamId) {
|
|
1441
|
-
if (this.activityTypeResponseDate && this.activityTypeResponseDate >
|
|
1501
|
+
if (this.activityTypeResponseDate && this.activityTypeResponseDate > sub(new Date(), { hours: 1 })) {
|
|
1442
1502
|
return of(this.activityTypeCollection);
|
|
1443
1503
|
}
|
|
1444
1504
|
return this.apiService
|
|
@@ -1460,6 +1520,14 @@ class ActivityService {
|
|
|
1460
1520
|
params
|
|
1461
1521
|
});
|
|
1462
1522
|
}
|
|
1523
|
+
resendInvite(teamId, activityId, activityInviteId) {
|
|
1524
|
+
return this.apiService
|
|
1525
|
+
.postResource(activityInviteFactory, Role.TeamAdmin, TEAM_ACTIVITY_INVITE_RESEND_PATH, {
|
|
1526
|
+
teamId,
|
|
1527
|
+
activityId,
|
|
1528
|
+
activityInviteId
|
|
1529
|
+
}, {});
|
|
1530
|
+
}
|
|
1463
1531
|
updateMemberActivity(memberId, activityInviteId, activityInvite) {
|
|
1464
1532
|
return this.apiService
|
|
1465
1533
|
.updateResource(activityInviteFactory, Role.MemberAdmin, MEMBER_ACTIVITY_INVITE_PATH, {
|
|
@@ -1479,7 +1547,15 @@ class ActivityService {
|
|
|
1479
1547
|
.updateResource(activityFactory, Role.TeamAdmin, TEAM_ACTIVITY_PATH, {
|
|
1480
1548
|
teamId,
|
|
1481
1549
|
id: activity.id
|
|
1482
|
-
}, activity);
|
|
1550
|
+
}, this.removeUnusedActivityFields(activity));
|
|
1551
|
+
}
|
|
1552
|
+
updateTeamActivityInvite(teamId, activityId, activityInviteId, activityInvite) {
|
|
1553
|
+
return this.apiService
|
|
1554
|
+
.updateResource(memberActivityInviteFactory, Role.TeamAdmin, TEAM_ACTIVITY_INVITE_PATH, {
|
|
1555
|
+
teamId,
|
|
1556
|
+
activityId,
|
|
1557
|
+
activityInviteId
|
|
1558
|
+
}, activityInvite);
|
|
1483
1559
|
}
|
|
1484
1560
|
updateTeamActivityParticipants(teamId, activityId, members) {
|
|
1485
1561
|
return this.apiService
|
|
@@ -1490,9 +1566,17 @@ class ActivityService {
|
|
|
1490
1566
|
members
|
|
1491
1567
|
});
|
|
1492
1568
|
}
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
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;
|
|
1496
1580
|
}
|
|
1497
1581
|
}
|
|
1498
1582
|
ActivityService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: ActivityService, deps: [{ token: ApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
@@ -1722,11 +1806,46 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.11", ngImpo
|
|
|
1722
1806
|
}], ctorParameters: function () { return [{ type: ApiService }]; } });
|
|
1723
1807
|
|
|
1724
1808
|
const MEMBER_DIRECTORIES_PATH = ':memberId/files/';
|
|
1725
|
-
const TEAM_DIRECTORIES_PATH = ':teamId/
|
|
1809
|
+
const TEAM_DIRECTORIES_PATH = ':teamId/directories/';
|
|
1810
|
+
const TEAM_DIRECTORY_PATH = ':teamId/directories/:directoryId/';
|
|
1811
|
+
const TEAM_FILES_PATH = ':teamId/directories/:directoryId/files/';
|
|
1812
|
+
const TEAM_FILE_PATH = ':teamId/directories/:directoryId/files/:fileId/';
|
|
1726
1813
|
class FileService {
|
|
1727
1814
|
constructor(apiService) {
|
|
1728
1815
|
this.apiService = apiService;
|
|
1729
1816
|
}
|
|
1817
|
+
createTeamDirectory(teamId, directory) {
|
|
1818
|
+
return this.apiService
|
|
1819
|
+
.postResource(directoryFactory, Role.TeamAdmin, TEAM_DIRECTORIES_PATH, {
|
|
1820
|
+
teamId
|
|
1821
|
+
}, directory);
|
|
1822
|
+
}
|
|
1823
|
+
createTeamFile(teamId, directoryId, file) {
|
|
1824
|
+
const formData = new FormData();
|
|
1825
|
+
const fileObj = file.file;
|
|
1826
|
+
formData.append('name', file.name);
|
|
1827
|
+
formData.append('file', fileObj, fileObj.name);
|
|
1828
|
+
return this.apiService
|
|
1829
|
+
.postFormData(fileFactory, Role.TeamAdmin, TEAM_FILES_PATH, {
|
|
1830
|
+
teamId,
|
|
1831
|
+
directoryId
|
|
1832
|
+
}, formData);
|
|
1833
|
+
}
|
|
1834
|
+
deleteTeamDirectory(teamId, directoryId) {
|
|
1835
|
+
return this.apiService
|
|
1836
|
+
.deleteResource(Role.TeamAdmin, TEAM_DIRECTORY_PATH, {
|
|
1837
|
+
teamId,
|
|
1838
|
+
directoryId
|
|
1839
|
+
});
|
|
1840
|
+
}
|
|
1841
|
+
deleteTeamFile(teamId, directoryId, fileId) {
|
|
1842
|
+
return this.apiService
|
|
1843
|
+
.deleteResource(Role.TeamAdmin, TEAM_FILE_PATH, {
|
|
1844
|
+
teamId,
|
|
1845
|
+
directoryId,
|
|
1846
|
+
fileId
|
|
1847
|
+
});
|
|
1848
|
+
}
|
|
1730
1849
|
getMemberDirectories(memberId) {
|
|
1731
1850
|
return this.apiService
|
|
1732
1851
|
.getCollection(directoryFactory, Role.MemberAdmin, MEMBER_DIRECTORIES_PATH, { memberId }, { params: { limit: 'null' } });
|
|
@@ -1982,14 +2101,55 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.11", ngImpo
|
|
|
1982
2101
|
}]
|
|
1983
2102
|
}], ctorParameters: function () { return [{ type: ApiService }]; } });
|
|
1984
2103
|
|
|
1985
|
-
const
|
|
2104
|
+
const MEMBER_NEWS_ITEMS_PATH = ':memberId/news/';
|
|
2105
|
+
const MEMBER_NEWS_ITEM_PATH = ':memberId/news/:id/';
|
|
2106
|
+
const TEAM_NEWS_ITEMS_PATH = ':teamId/news/';
|
|
2107
|
+
const TEAM_NEWS_ITEM_PATH = ':teamId/news/:id/';
|
|
1986
2108
|
class NewsService {
|
|
1987
2109
|
constructor(apiService) {
|
|
1988
2110
|
this.apiService = apiService;
|
|
1989
2111
|
}
|
|
2112
|
+
createTeamNews(teamId, news) {
|
|
2113
|
+
delete news.id;
|
|
2114
|
+
return this.apiService
|
|
2115
|
+
.postFormData(newsFactory, Role.TeamAdmin, TEAM_NEWS_ITEMS_PATH, {
|
|
2116
|
+
teamId
|
|
2117
|
+
}, this.createFormData(news));
|
|
2118
|
+
}
|
|
2119
|
+
deleteTeamNews(teamId, id) {
|
|
2120
|
+
return this.apiService
|
|
2121
|
+
.deleteResource(Role.TeamAdmin, TEAM_NEWS_ITEM_PATH, {
|
|
2122
|
+
teamId,
|
|
2123
|
+
id
|
|
2124
|
+
});
|
|
2125
|
+
}
|
|
2126
|
+
getMemberNews(memberId, id) {
|
|
2127
|
+
return this.apiService
|
|
2128
|
+
.getResource(newsFactory, Role.MemberAdmin, MEMBER_NEWS_ITEM_PATH, {
|
|
2129
|
+
memberId,
|
|
2130
|
+
id
|
|
2131
|
+
});
|
|
2132
|
+
}
|
|
2133
|
+
getTeamNews(teamId, id) {
|
|
2134
|
+
return this.apiService
|
|
2135
|
+
.getResource(newsFactory, Role.TeamAdmin, TEAM_NEWS_ITEM_PATH, {
|
|
2136
|
+
teamId,
|
|
2137
|
+
id
|
|
2138
|
+
});
|
|
2139
|
+
}
|
|
2140
|
+
listMemberNews(memberId, offset) {
|
|
2141
|
+
return this.apiService
|
|
2142
|
+
.getCollection(newsFactory, Role.MemberAdmin, MEMBER_NEWS_ITEMS_PATH, {
|
|
2143
|
+
memberId
|
|
2144
|
+
}, {
|
|
2145
|
+
params: {
|
|
2146
|
+
offset: offset.toString(10)
|
|
2147
|
+
}
|
|
2148
|
+
});
|
|
2149
|
+
}
|
|
1990
2150
|
listTeamNews(teamId, offset) {
|
|
1991
2151
|
return this.apiService
|
|
1992
|
-
.getCollection(newsFactory, Role.TeamAdmin,
|
|
2152
|
+
.getCollection(newsFactory, Role.TeamAdmin, TEAM_NEWS_ITEMS_PATH, {
|
|
1993
2153
|
teamId
|
|
1994
2154
|
}, {
|
|
1995
2155
|
params: {
|
|
@@ -1997,6 +2157,36 @@ class NewsService {
|
|
|
1997
2157
|
}
|
|
1998
2158
|
});
|
|
1999
2159
|
}
|
|
2160
|
+
updateTeamNews(teamId, id, news) {
|
|
2161
|
+
return this.apiService
|
|
2162
|
+
.postFormData(newsFactory, Role.TeamAdmin, TEAM_NEWS_ITEM_PATH, {
|
|
2163
|
+
teamId,
|
|
2164
|
+
id
|
|
2165
|
+
}, this.createFormData(news));
|
|
2166
|
+
}
|
|
2167
|
+
createFormData(news) {
|
|
2168
|
+
const formData = new FormData();
|
|
2169
|
+
if (!news.active_to) {
|
|
2170
|
+
news.active_to = null;
|
|
2171
|
+
}
|
|
2172
|
+
if (!news.news_image) {
|
|
2173
|
+
news.news_image = new File([], '');
|
|
2174
|
+
}
|
|
2175
|
+
if (!news.published_date) {
|
|
2176
|
+
news.published_date = null;
|
|
2177
|
+
}
|
|
2178
|
+
formData.append('title', news?.title);
|
|
2179
|
+
formData.append('ingress', news?.ingress);
|
|
2180
|
+
formData.append('text', news?.text);
|
|
2181
|
+
if (typeof news?.news_image !== 'undefined' && news?.news_image instanceof File) {
|
|
2182
|
+
formData.append('news_image', news?.news_image);
|
|
2183
|
+
}
|
|
2184
|
+
formData.append('news_image_text', news?.news_image_text);
|
|
2185
|
+
formData.append('published_date', news?.published_date ? news?.published_date : '');
|
|
2186
|
+
formData.append('active_to', news?.active_to ? news?.active_to : '');
|
|
2187
|
+
formData.append('show_on_my_pages', `${news?.show_on_my_pages || false}`);
|
|
2188
|
+
return formData;
|
|
2189
|
+
}
|
|
2000
2190
|
}
|
|
2001
2191
|
NewsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: NewsService, deps: [{ token: ApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2002
2192
|
NewsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: NewsService, providedIn: 'root' });
|
|
@@ -2025,7 +2215,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.11", ngImpo
|
|
|
2025
2215
|
}]
|
|
2026
2216
|
}], ctorParameters: function () { return [{ type: ApiService }]; } });
|
|
2027
2217
|
|
|
2028
|
-
const CLUB_TEAMS_PATH = '
|
|
2218
|
+
const CLUB_TEAMS_PATH = ':clubId/teams/';
|
|
2029
2219
|
const MEMBER_TEAM_MEMBER_PATH = ':memberId/teams/:teamId/team-members/:id/';
|
|
2030
2220
|
const MEMBER_TEAM_MEMBERS_PATH = ':memberId/teams/:teamId/team-members/';
|
|
2031
2221
|
const MEMBER_TEAM_EXTRA_MEMBER_PATH = ':memberId/teams/:teamId/extra-members/:id/';
|
|
@@ -2046,7 +2236,7 @@ class TeamService {
|
|
|
2046
2236
|
return this.apiService.deleteResource(Role.TeamAdmin, TEAM_LEADER_TEAM_MEMBER_PATH, { teamId, id });
|
|
2047
2237
|
}
|
|
2048
2238
|
getClubTeams(clubId) {
|
|
2049
|
-
return this.apiService.getCollection(
|
|
2239
|
+
return this.apiService.getCollection(clubTeamFactory, Role.ClubAdmin, CLUB_TEAMS_PATH, { clubId });
|
|
2050
2240
|
}
|
|
2051
2241
|
getMemberTeam(memberId, teamId) {
|
|
2052
2242
|
return this.apiService.getResource(memberTeamFactory, Role.MemberAdmin, MEMBER_TEAM_PATH, { memberId, teamId });
|
|
@@ -2067,7 +2257,7 @@ class TeamService {
|
|
|
2067
2257
|
return this.apiService.getCollection(searchMemberTeamFactory, Role.MemberAdmin, MEMBER_TEAMS_PATH, { memberId });
|
|
2068
2258
|
}
|
|
2069
2259
|
getSectionTeams(role, sectionId) {
|
|
2070
|
-
return this.apiService.getCollection(
|
|
2260
|
+
return this.apiService.getCollection(sectionTeamFactory, role, SECTION_TEAMS_PATH, { sectionId });
|
|
2071
2261
|
}
|
|
2072
2262
|
getTeamLeaderTeam(teamId) {
|
|
2073
2263
|
return this.apiService.getResource(memberTeamFactory, Role.TeamAdmin, TEAM_LEADER_TEAM_PATH, { teamId });
|
|
@@ -2127,7 +2317,7 @@ class TokenService {
|
|
|
2127
2317
|
if (err.status === 401) {
|
|
2128
2318
|
return of(null);
|
|
2129
2319
|
}
|
|
2130
|
-
return throwError(err);
|
|
2320
|
+
return throwError(() => err);
|
|
2131
2321
|
}));
|
|
2132
2322
|
}
|
|
2133
2323
|
logout() {
|
|
@@ -2299,6 +2489,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.11", ngImpo
|
|
|
2299
2489
|
class AuthenticationInterceptor {
|
|
2300
2490
|
constructor(authenticationService) {
|
|
2301
2491
|
this.authenticationService = authenticationService;
|
|
2492
|
+
this.isRefreshing = false;
|
|
2493
|
+
this.refreshTokenSubject = new BehaviorSubject(null);
|
|
2302
2494
|
}
|
|
2303
2495
|
intercept(request, next) {
|
|
2304
2496
|
const authentication = this.authenticationService.authentication;
|
|
@@ -2307,16 +2499,9 @@ class AuthenticationInterceptor {
|
|
|
2307
2499
|
}
|
|
2308
2500
|
return next.handle(request).pipe(catchError((requestError) => {
|
|
2309
2501
|
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
|
-
}
|
|
2502
|
+
return this.handle401Error(request, next);
|
|
2318
2503
|
}
|
|
2319
|
-
return throwError(requestError);
|
|
2504
|
+
return throwError(() => requestError);
|
|
2320
2505
|
}));
|
|
2321
2506
|
}
|
|
2322
2507
|
addAuthorizationHeader(request, token) {
|
|
@@ -2327,11 +2512,34 @@ class AuthenticationInterceptor {
|
|
|
2327
2512
|
}
|
|
2328
2513
|
return request;
|
|
2329
2514
|
}
|
|
2515
|
+
handle401Error(request, next) {
|
|
2516
|
+
if (this.isRefreshing) {
|
|
2517
|
+
return this.refreshTokenSubject
|
|
2518
|
+
.pipe(filter(token => token !== null), take(1), switchMap((token) => next.handle(this.addAuthorizationHeader(request, token?.accessToken))));
|
|
2519
|
+
}
|
|
2520
|
+
else {
|
|
2521
|
+
this.isRefreshing = true;
|
|
2522
|
+
this.refreshTokenSubject.next(null);
|
|
2523
|
+
return this.authenticationService.reauthenticate()
|
|
2524
|
+
.pipe(catchError((err) => {
|
|
2525
|
+
this.isRefreshing = false;
|
|
2526
|
+
this.authenticationService.clearAuthentication();
|
|
2527
|
+
return throwError(() => err);
|
|
2528
|
+
}), switchMap((token) => {
|
|
2529
|
+
this.refreshTokenSubject.next(token);
|
|
2530
|
+
this.isRefreshing = false;
|
|
2531
|
+
return next.handle(this.addAuthorizationHeader(request, token.accessToken));
|
|
2532
|
+
}));
|
|
2533
|
+
}
|
|
2534
|
+
}
|
|
2330
2535
|
}
|
|
2331
2536
|
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 });
|
|
2537
|
+
AuthenticationInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: AuthenticationInterceptor, providedIn: 'root' });
|
|
2333
2538
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: AuthenticationInterceptor, decorators: [{
|
|
2334
|
-
type: Injectable
|
|
2539
|
+
type: Injectable,
|
|
2540
|
+
args: [{
|
|
2541
|
+
providedIn: 'root'
|
|
2542
|
+
}]
|
|
2335
2543
|
}], ctorParameters: function () { return [{ type: AuthenticationService }]; } });
|
|
2336
2544
|
|
|
2337
2545
|
const REDIRECT_PARAM_NAME = 'next';
|
|
@@ -2396,18 +2604,18 @@ class DataAccessModule {
|
|
|
2396
2604
|
providers: [
|
|
2397
2605
|
{ provide: APP, useValue: config.app },
|
|
2398
2606
|
{ provide: DOMAIN, useValue: config.domain },
|
|
2399
|
-
{ provide: HTTP_INTERCEPTORS,
|
|
2607
|
+
{ provide: HTTP_INTERCEPTORS, useExisting: AuthenticationInterceptor, multi: true }
|
|
2400
2608
|
]
|
|
2401
2609
|
};
|
|
2402
2610
|
}
|
|
2403
2611
|
}
|
|
2404
2612
|
DataAccessModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: DataAccessModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2405
|
-
DataAccessModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.11", ngImport: i0, type: DataAccessModule
|
|
2406
|
-
DataAccessModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: DataAccessModule
|
|
2613
|
+
DataAccessModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.11", ngImport: i0, type: DataAccessModule });
|
|
2614
|
+
DataAccessModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: DataAccessModule });
|
|
2407
2615
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: DataAccessModule, decorators: [{
|
|
2408
2616
|
type: NgModule,
|
|
2409
2617
|
args: [{
|
|
2410
|
-
imports: [
|
|
2618
|
+
imports: [] // TODO: Check if this is required
|
|
2411
2619
|
}]
|
|
2412
2620
|
}] });
|
|
2413
2621
|
|
|
@@ -2419,5 +2627,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.11", ngImpo
|
|
|
2419
2627
|
* Generated bundle index. Do not edit.
|
|
2420
2628
|
*/
|
|
2421
2629
|
|
|
2422
|
-
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,
|
|
2630
|
+
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 };
|
|
2423
2631
|
//# sourceMappingURL=myclub_se-data-access.mjs.map
|