@myclub_se/data-access 3.2.0 → 3.2.2
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/esm2022/lib/api-models/api-booking-calendar.mjs +1 -1
- package/esm2022/lib/models/booking-calendar.mjs +5 -5
- package/esm2022/lib/models/user.mjs +5 -2
- package/esm2022/lib/services/auth.service.mjs +17 -1
- package/esm2022/lib/services/bookable.service.mjs +16 -2
- package/esm2022/lib/services/factories/booking-calendar-factory.mjs +2 -2
- package/esm2022/lib/services/factories/user-factory.mjs +2 -2
- package/esm2022/lib/services/member.service.mjs +18 -11
- package/fesm2022/myclub_se-data-access.mjs +58 -18
- package/fesm2022/myclub_se-data-access.mjs.map +1 -1
- package/lib/api-models/api-booking-calendar.d.ts +1 -1
- package/lib/models/booking-calendar.d.ts +3 -3
- package/lib/models/user.d.ts +2 -1
- package/lib/services/auth.service.d.ts +2 -0
- package/lib/services/bookable.service.d.ts +2 -1
- package/lib/services/member.service.d.ts +4 -4
- package/package.json +1 -1
|
@@ -1981,7 +1981,7 @@ class BookingCalendar {
|
|
|
1981
1981
|
allow_repeated_bookings;
|
|
1982
1982
|
is_default;
|
|
1983
1983
|
payment_limit_in_minutes;
|
|
1984
|
-
|
|
1984
|
+
price_per_slot;
|
|
1985
1985
|
available_for_teams;
|
|
1986
1986
|
bookable_groups;
|
|
1987
1987
|
type;
|
|
@@ -2017,12 +2017,12 @@ class BookingCalendar {
|
|
|
2017
2017
|
allow_team_export: new FormControl(calendar?.allow_team_export || false),
|
|
2018
2018
|
allow_repeated_bookings: new FormControl(calendar?.allow_repeated_bookings || false),
|
|
2019
2019
|
type: new FormControl(calendar?.type || null),
|
|
2020
|
-
|
|
2020
|
+
price_per_slot: new FormControl(calendar?.price_per_slot || 0),
|
|
2021
2021
|
payment_limit_in_minutes: new FormControl(calendar?.payment_limit_in_minutes || 0),
|
|
2022
2022
|
member_fee_id: new FormControl(calendar?.member_fee_id || null),
|
|
2023
2023
|
});
|
|
2024
2024
|
}
|
|
2025
|
-
constructor(id, club_id, section_id, team_id, club_name, name, section_name, team_name, status, max_application_number, allow_team_export, allow_repeated_bookings, is_default, payment_limit_in_minutes = 0,
|
|
2025
|
+
constructor(id, club_id, section_id, team_id, club_name, name, section_name, team_name, status, max_application_number, allow_team_export, allow_repeated_bookings, is_default, payment_limit_in_minutes = 0, price_per_slot = 0, available_for_teams, bookable_groups, type, type_display, member_fee_id) {
|
|
2026
2026
|
this.id = id;
|
|
2027
2027
|
this.club_id = club_id;
|
|
2028
2028
|
this.section_id = section_id;
|
|
@@ -2037,7 +2037,7 @@ class BookingCalendar {
|
|
|
2037
2037
|
this.allow_repeated_bookings = allow_repeated_bookings;
|
|
2038
2038
|
this.is_default = is_default;
|
|
2039
2039
|
this.payment_limit_in_minutes = payment_limit_in_minutes;
|
|
2040
|
-
this.
|
|
2040
|
+
this.price_per_slot = price_per_slot;
|
|
2041
2041
|
this.available_for_teams = available_for_teams;
|
|
2042
2042
|
this.bookable_groups = bookable_groups;
|
|
2043
2043
|
this.type = type;
|
|
@@ -4109,6 +4109,7 @@ class Token {
|
|
|
4109
4109
|
}
|
|
4110
4110
|
|
|
4111
4111
|
class User {
|
|
4112
|
+
id;
|
|
4112
4113
|
deviceToken;
|
|
4113
4114
|
email;
|
|
4114
4115
|
firstName;
|
|
@@ -4122,6 +4123,7 @@ class User {
|
|
|
4122
4123
|
password;
|
|
4123
4124
|
static asFormGroup(user = null) {
|
|
4124
4125
|
return new FormGroup({
|
|
4126
|
+
id: new FormControl(user?.id || ''),
|
|
4125
4127
|
email: new FormControl(user?.email || '', [Validators.required, Validators.email]),
|
|
4126
4128
|
firstName: new FormControl(user?.firstName || ''),
|
|
4127
4129
|
language: new FormControl(user?.language || 'sv'),
|
|
@@ -4132,7 +4134,8 @@ class User {
|
|
|
4132
4134
|
password: new FormControl('')
|
|
4133
4135
|
});
|
|
4134
4136
|
}
|
|
4135
|
-
constructor(deviceToken, email, firstName, isStaff, language, lastName, newEmail, twoFaVerified, newPassword = '', verifyPassword = '', password = '') {
|
|
4137
|
+
constructor(id, deviceToken, email, firstName, isStaff, language, lastName, newEmail, twoFaVerified, newPassword = '', verifyPassword = '', password = '') {
|
|
4138
|
+
this.id = id;
|
|
4136
4139
|
this.deviceToken = deviceToken;
|
|
4137
4140
|
this.email = email;
|
|
4138
4141
|
this.firstName = firstName;
|
|
@@ -4247,7 +4250,7 @@ const sectionFactory = (apiSection) => new Section(apiSection.id, apiSection.nam
|
|
|
4247
4250
|
|
|
4248
4251
|
const searchTeamFactory = (apiSearchTeam) => new SearchTeam(apiSearchTeam.club ? clubFactory(apiSearchTeam.club) : undefined, apiSearchTeam.section ? sectionFactory(apiSearchTeam.section) : undefined, apiSearchTeam.id, apiSearchTeam.club_name, apiSearchTeam.name, apiSearchTeam.section_name, apiSearchTeam.show_memberships, apiSearchTeam.team_admin_2fa_required);
|
|
4249
4252
|
|
|
4250
|
-
const bookingCalendarFactory = (apiBookingCalendar) => new BookingCalendar(apiBookingCalendar.id, apiBookingCalendar.club_id, apiBookingCalendar.section_id, apiBookingCalendar.team_id, apiBookingCalendar.club_name, apiBookingCalendar.name, apiBookingCalendar.section_name, apiBookingCalendar.team_name, apiBookingCalendar.status, apiBookingCalendar.max_application_number, apiBookingCalendar.allow_team_export, apiBookingCalendar.allow_repeated_bookings, apiBookingCalendar.is_default, apiBookingCalendar.payment_limit_in_minutes, apiBookingCalendar.
|
|
4253
|
+
const bookingCalendarFactory = (apiBookingCalendar) => new BookingCalendar(apiBookingCalendar.id, apiBookingCalendar.club_id, apiBookingCalendar.section_id, apiBookingCalendar.team_id, apiBookingCalendar.club_name, apiBookingCalendar.name, apiBookingCalendar.section_name, apiBookingCalendar.team_name, apiBookingCalendar.status, apiBookingCalendar.max_application_number, apiBookingCalendar.allow_team_export, apiBookingCalendar.allow_repeated_bookings, apiBookingCalendar.is_default, apiBookingCalendar.payment_limit_in_minutes, apiBookingCalendar.price_per_slot, apiBookingCalendar.available_for_teams && apiBookingCalendar.available_for_teams.length ? apiBookingCalendar.available_for_teams.map((apiSearchTeam) => searchTeamFactory(apiSearchTeam)) : [], apiBookingCalendar.bookable_groups && apiBookingCalendar.bookable_groups.length ? apiBookingCalendar.bookable_groups.map((apiBookableGroup) => bookableGroupFactory(apiBookableGroup)) : [], apiBookingCalendar.type, apiBookingCalendar.type_display, apiBookingCalendar.member_fee_id);
|
|
4251
4254
|
|
|
4252
4255
|
const bookingCalendarApplicationTimeFactory = (apiBookingApplicationTime) => new BookingCalendarApplicationTime(apiBookingApplicationTime.id, apiBookingApplicationTime.section_id, apiBookingApplicationTime.slot_id, apiBookingApplicationTime.team_id, apiBookingApplicationTime.title, apiBookingApplicationTime.end_time, apiBookingApplicationTime.section_name, apiBookingApplicationTime.start_time, apiBookingApplicationTime.team_name, apiBookingApplicationTime.applicant_comment, apiBookingApplicationTime.reviewer_comment, apiBookingApplicationTime.status, apiBookingApplicationTime.repeat, apiBookingApplicationTime.activity_type_id, apiBookingApplicationTime.color, apiBookingApplicationTime.slot_start_time, apiBookingApplicationTime.slot_end_time, apiBookingApplicationTime.slot_day, apiBookingApplicationTime.slot_number_of_available_sessions, apiBookingApplicationTime.slot_last_repeating_date, apiBookingApplicationTime.created, apiBookingApplicationTime.bookable_zones_taken, apiBookingApplicationTime.bookable_zones_taken_display, apiBookingApplicationTime.bookable_part_id, apiBookingApplicationTime.bookable_part_name, apiBookingApplicationTime.bookable_id, apiBookingApplicationTime.bookable_name, apiBookingApplicationTime.member_id, apiBookingApplicationTime.member_name, apiBookingApplicationTime.member_email, apiBookingApplicationTime.price, false);
|
|
4253
4256
|
|
|
@@ -4399,7 +4402,7 @@ const swishIncidentFactory = (apiSwishIncident) => new SwishIncident(apiSwishInc
|
|
|
4399
4402
|
|
|
4400
4403
|
const tokenFactory = (apiToken) => new Token(apiToken.access_token, apiToken.refresh_token);
|
|
4401
4404
|
|
|
4402
|
-
const userFactory = (apiUser) => new User(apiUser.device_token, apiUser.email, apiUser.first_name, apiUser.is_staff, apiUser.language, apiUser.last_name, apiUser.new_email, apiUser.two_fa_verified);
|
|
4405
|
+
const userFactory = (apiUser) => new User(apiUser.id, apiUser.device_token, apiUser.email, apiUser.first_name, apiUser.is_staff, apiUser.language, apiUser.last_name, apiUser.new_email, apiUser.two_fa_verified);
|
|
4403
4406
|
|
|
4404
4407
|
const userNotificationFactory = (apiUserNotification) => new UserNotification(apiUserNotification.id, apiUserNotification.club_id, apiUserNotification.member_id, apiUserNotification.object_id, apiUserNotification.created, apiUserNotification.message, apiUserNotification.title, apiUserNotification.type);
|
|
4405
4408
|
|
|
@@ -5054,6 +5057,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImpor
|
|
|
5054
5057
|
|
|
5055
5058
|
const AUTHS_PATH = 'every-admin/auths/';
|
|
5056
5059
|
const REMOVE_AUTH_PATH = 'accounts/remove-auth/:authId/:authType/:id/';
|
|
5060
|
+
const SELECT_MEMBER_AUTH_PATH = 'every-admin/auths/select-member-auth/:userId/:clubId/:memberId/';
|
|
5061
|
+
const SELECT_TEAM_AUTH_PATH = 'every-admin/auths/select-team-auth/:userId/:clubId/:teamId/';
|
|
5057
5062
|
const UPDATE_MEMBERS_PATH = 'every-admin/auths/update-members/';
|
|
5058
5063
|
class AuthService {
|
|
5059
5064
|
apiService;
|
|
@@ -5085,6 +5090,20 @@ class AuthService {
|
|
|
5085
5090
|
removeTeamAuth(authId, teamId) {
|
|
5086
5091
|
return this.removeAuth(authId, teamId, 'team');
|
|
5087
5092
|
}
|
|
5093
|
+
selectMemberAuth(userId, clubId, memberId) {
|
|
5094
|
+
return this.apiService.updateResourceNoResponse(Role.None, SELECT_MEMBER_AUTH_PATH, {
|
|
5095
|
+
userId,
|
|
5096
|
+
clubId,
|
|
5097
|
+
memberId
|
|
5098
|
+
}, {}).pipe(map(() => true), catchError(() => of(false)));
|
|
5099
|
+
}
|
|
5100
|
+
selectTeamAuth(userId, clubId, teamId) {
|
|
5101
|
+
return this.apiService.updateResourceNoResponse(Role.None, SELECT_TEAM_AUTH_PATH, {
|
|
5102
|
+
userId,
|
|
5103
|
+
clubId,
|
|
5104
|
+
teamId
|
|
5105
|
+
}, {}).pipe(map(() => true), catchError(() => of(false)));
|
|
5106
|
+
}
|
|
5088
5107
|
updateMembers() {
|
|
5089
5108
|
return this.apiService.updateResourceNoResponse(Role.None, UPDATE_MEMBERS_PATH, {}, {})
|
|
5090
5109
|
.pipe(map(() => true), catchError(() => of(false)));
|
|
@@ -5154,11 +5173,25 @@ class BookableService {
|
|
|
5154
5173
|
return this.apiService
|
|
5155
5174
|
.getCollection(bookableItemFactory, Role.TeamAdmin, TEAM_BOOKABLES_PATH, { teamId }, { params: { limit: 'null' } });
|
|
5156
5175
|
}
|
|
5157
|
-
getMemberBookableItems(memberId, date = null) {
|
|
5176
|
+
getMemberBookableItems(memberId, date = null, startDate = null, endDate = null) {
|
|
5158
5177
|
const params = { limit: 'null', has_available_sessions: 'true' };
|
|
5159
5178
|
if (date) {
|
|
5160
5179
|
params['day'] = date;
|
|
5161
5180
|
}
|
|
5181
|
+
if (startDate) {
|
|
5182
|
+
params['day__gte'] = startDate;
|
|
5183
|
+
}
|
|
5184
|
+
if (endDate) {
|
|
5185
|
+
params['day__lte'] = endDate;
|
|
5186
|
+
}
|
|
5187
|
+
return this.apiService
|
|
5188
|
+
.getCollection(bookableItemFactory, Role.MemberAdmin, MEMBER_BOOKABLES_PATH, { memberId }, { params: params });
|
|
5189
|
+
}
|
|
5190
|
+
getMemberBookableItemsForDateRange(memberId, weekStart, weekEnd) {
|
|
5191
|
+
const params = {
|
|
5192
|
+
limit: 'null',
|
|
5193
|
+
has_available_sessions: 'true',
|
|
5194
|
+
};
|
|
5162
5195
|
return this.apiService
|
|
5163
5196
|
.getCollection(bookableItemFactory, Role.MemberAdmin, MEMBER_BOOKABLES_PATH, { memberId }, { params: params });
|
|
5164
5197
|
}
|
|
@@ -6947,26 +6980,33 @@ class MemberService {
|
|
|
6947
6980
|
return this.apiService
|
|
6948
6981
|
.updateResource(memberFactory, Role.MemberAdmin, MEMBER_PROFILE_PATH, { memberId }, memberProfile);
|
|
6949
6982
|
}
|
|
6950
|
-
getMembers(role, itemId) {
|
|
6983
|
+
getMembers(role, itemId, searchTerm = null, memberId = null) {
|
|
6984
|
+
let params = {};
|
|
6985
|
+
if (searchTerm) {
|
|
6986
|
+
params['q'] = searchTerm;
|
|
6987
|
+
}
|
|
6988
|
+
if (memberId) {
|
|
6989
|
+
params['id'] = memberId;
|
|
6990
|
+
}
|
|
6951
6991
|
switch (role) {
|
|
6952
6992
|
case Role.ClubAdmin:
|
|
6953
|
-
return this.getClubMembers(itemId);
|
|
6993
|
+
return this.getClubMembers(itemId, params);
|
|
6954
6994
|
case Role.SectionAdmin:
|
|
6955
|
-
return this.getSectionMembers(itemId);
|
|
6995
|
+
return this.getSectionMembers(itemId, params);
|
|
6956
6996
|
case Role.TeamAdmin:
|
|
6957
|
-
return this.getTeamMembers(itemId);
|
|
6997
|
+
return this.getTeamMembers(itemId, params);
|
|
6958
6998
|
default:
|
|
6959
6999
|
throw invalidRoleError;
|
|
6960
7000
|
}
|
|
6961
7001
|
}
|
|
6962
|
-
getClubMembers(clubId) {
|
|
6963
|
-
return this.apiService.getCollection(searchMemberFactory, Role.ClubAdmin, CLUB_MEMBERS_PATH, { clubId });
|
|
7002
|
+
getClubMembers(clubId, params = {}) {
|
|
7003
|
+
return this.apiService.getCollection(searchMemberFactory, Role.ClubAdmin, CLUB_MEMBERS_PATH, { clubId }, { params: params });
|
|
6964
7004
|
}
|
|
6965
|
-
getSectionMembers(sectionId) {
|
|
6966
|
-
return this.apiService.getCollection(searchMemberFactory, Role.SectionAdmin, SECTION_MEMBERS_PATH, { sectionId });
|
|
7005
|
+
getSectionMembers(sectionId, params = {}) {
|
|
7006
|
+
return this.apiService.getCollection(searchMemberFactory, Role.SectionAdmin, SECTION_MEMBERS_PATH, { sectionId }, { params: params });
|
|
6967
7007
|
}
|
|
6968
|
-
getTeamMembers(teamId) {
|
|
6969
|
-
return this.apiService.getCollection(searchMemberFactory, Role.TeamAdmin, TEAM_MEMBERS_PATH, { teamId });
|
|
7008
|
+
getTeamMembers(teamId, params = {}) {
|
|
7009
|
+
return this.apiService.getCollection(searchMemberFactory, Role.TeamAdmin, TEAM_MEMBERS_PATH, { teamId }, { params: params });
|
|
6970
7010
|
}
|
|
6971
7011
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: MemberService, deps: [{ token: ApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6972
7012
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: MemberService, providedIn: 'root' });
|