abmp-npm 2.0.29 → 2.0.30
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.
|
@@ -9,6 +9,22 @@ const { bulkProcessAndSaveMemberData } = require('./bulk-process-methods');
|
|
|
9
9
|
const { MEMBER_ACTIONS } = require('./consts');
|
|
10
10
|
const { isUpdatedMember, isSiteAssociatedMember } = require('./utils');
|
|
11
11
|
|
|
12
|
+
const filterLicensesByAssociation = (member, siteAssociation) => {
|
|
13
|
+
if (!member?.licenses || !Array.isArray(member.licenses)) {
|
|
14
|
+
return member;
|
|
15
|
+
}
|
|
16
|
+
const filteredLicenses = member.licenses.filter(license => {
|
|
17
|
+
if (!license || !license.association) {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
return license.association === siteAssociation;
|
|
21
|
+
});
|
|
22
|
+
return {
|
|
23
|
+
...member,
|
|
24
|
+
licenses: filteredLicenses,
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
|
|
12
28
|
async function syncMembersDataPerAction(taskData) {
|
|
13
29
|
const { action, backupDate, isTestEnvironment, includeNone } = taskData;
|
|
14
30
|
try {
|
|
@@ -110,6 +126,9 @@ async function synchronizeSinglePage(taskObject) {
|
|
|
110
126
|
}
|
|
111
127
|
return isUpdatedMember(member);
|
|
112
128
|
});
|
|
129
|
+
const toSyncMembersWithFilteredLicenses = toSyncMembers.map(member =>
|
|
130
|
+
filterLicensesByAssociation(member, siteAssociation)
|
|
131
|
+
);
|
|
113
132
|
if (toSyncMembers.length === 0) {
|
|
114
133
|
return {
|
|
115
134
|
success: true,
|
|
@@ -120,7 +139,7 @@ async function synchronizeSinglePage(taskObject) {
|
|
|
120
139
|
};
|
|
121
140
|
}
|
|
122
141
|
const result = await bulkProcessAndSaveMemberData({
|
|
123
|
-
memberDataList:
|
|
142
|
+
memberDataList: toSyncMembersWithFilteredLicenses,
|
|
124
143
|
currentPageNumber: pageNumber,
|
|
125
144
|
});
|
|
126
145
|
|