@plusscommunities/pluss-core-aws 1.5.19-beta.0 → 1.5.20-beta.0
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.
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
const _ = require("lodash");
|
|
2
2
|
const indexQuery = require("../../db/common/indexQuery");
|
|
3
|
-
const getRef = require("../../db/common/getRef");
|
|
4
3
|
const scanRefRecursive = require("../../db/common/scanRefRecursive");
|
|
5
4
|
const userToUserPreview = require("../userToUserPreview");
|
|
6
|
-
const { getRowId, log } = require("..");
|
|
7
5
|
|
|
8
6
|
const getUsers = async (site) => {
|
|
9
7
|
if (site === "all") {
|
|
@@ -107,47 +105,6 @@ const getTagMatches = async (users, audienceTypeSelection, site) => {
|
|
|
107
105
|
);
|
|
108
106
|
};
|
|
109
107
|
|
|
110
|
-
const getEventMatches = async (users, audienceTypeSelection) => {
|
|
111
|
-
const logId = log("getEventMatches", "input", {
|
|
112
|
-
usersLength: users.length,
|
|
113
|
-
audienceTypeSelection,
|
|
114
|
-
});
|
|
115
|
-
let eventAudiences = [];
|
|
116
|
-
if (Array.isArray(audienceTypeSelection)) {
|
|
117
|
-
eventAudiences = _.filter(
|
|
118
|
-
audienceTypeSelection,
|
|
119
|
-
(at) => at.AudienceType === "EventAudience"
|
|
120
|
-
);
|
|
121
|
-
} else {
|
|
122
|
-
eventAudiences.push({ AudienceTypeSelection: audienceTypeSelection });
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
let userIds = [];
|
|
126
|
-
|
|
127
|
-
for (let i = 0; i < eventAudiences.length; i++) {
|
|
128
|
-
log("getEventMatches", "MatchingEventAudience", eventAudiences[i], logId);
|
|
129
|
-
const eventRep = await getRef(
|
|
130
|
-
"eventreps",
|
|
131
|
-
"RowId",
|
|
132
|
-
getRowId(
|
|
133
|
-
eventAudiences[i].AudienceTypeSelection.RowId,
|
|
134
|
-
eventAudiences[i].AudienceTypeSelection.RepId
|
|
135
|
-
)
|
|
136
|
-
);
|
|
137
|
-
if (eventRep && eventRep.Attendees) {
|
|
138
|
-
userIds = _.concat(userIds, Object.keys(eventRep.Attendees));
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
log("getEventMatches", "userIdsLength", userIds.length, logId);
|
|
142
|
-
}
|
|
143
|
-
return _.filter(users, (u) => {
|
|
144
|
-
log("getEventMatches", "userId", u.id, logId);
|
|
145
|
-
log("getEventMatches", "containsUserId", _.includes(userIds, u.id), logId);
|
|
146
|
-
|
|
147
|
-
return _.includes(userIds, u.id);
|
|
148
|
-
});
|
|
149
|
-
};
|
|
150
|
-
|
|
151
108
|
module.exports = async (
|
|
152
109
|
site,
|
|
153
110
|
audienceType,
|
|
@@ -181,20 +138,11 @@ module.exports = async (
|
|
|
181
138
|
audienceTypeSelection,
|
|
182
139
|
site
|
|
183
140
|
);
|
|
184
|
-
const eventMatches = await getEventMatches(users, audienceTypeSelection);
|
|
185
141
|
|
|
186
142
|
// console.log("categoryMatches", categoryMatches);
|
|
187
143
|
// console.log("typeMatches", typeMatches);
|
|
188
144
|
// console.log("tagMatches", tagMatches);
|
|
189
|
-
return _.unionBy(
|
|
190
|
-
categoryMatches,
|
|
191
|
-
typeMatches,
|
|
192
|
-
tagMatches,
|
|
193
|
-
eventMatches,
|
|
194
|
-
"id"
|
|
195
|
-
);
|
|
196
|
-
case "EventAudience":
|
|
197
|
-
return await getEventMatches(users, audienceTypeSelection);
|
|
145
|
+
return _.unionBy(categoryMatches, typeMatches, tagMatches, "id");
|
|
198
146
|
case "Category":
|
|
199
147
|
return await getCategoryMatches(users, audienceTypeSelection, site);
|
|
200
148
|
case "UserType":
|
package/package.json
CHANGED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
const getRef = require("../common/getRef");
|
|
2
|
-
|
|
3
|
-
module.exports = async (site, key) => {
|
|
4
|
-
return new Promise((resolve, reject) => {
|
|
5
|
-
getRef("sites", "Id", site)
|
|
6
|
-
.then((item) => {
|
|
7
|
-
if (item && item.Settings) {
|
|
8
|
-
return resolve(item.Settings[key]);
|
|
9
|
-
}
|
|
10
|
-
return resolve(undefined);
|
|
11
|
-
})
|
|
12
|
-
.catch((error) => {
|
|
13
|
-
return resolve(undefined);
|
|
14
|
-
});
|
|
15
|
-
});
|
|
16
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
const getSiteSetting = require("../../db/auth/getSiteSetting");
|
|
2
|
-
|
|
3
|
-
module.exports = async (site, key, expectedValue) => {
|
|
4
|
-
return new Promise(async (resolve) => {
|
|
5
|
-
if (!site) {
|
|
6
|
-
return resolve(false);
|
|
7
|
-
}
|
|
8
|
-
const siteSetting = await getSiteSetting(site, key);
|
|
9
|
-
return resolve(siteSetting === expectedValue);
|
|
10
|
-
});
|
|
11
|
-
};
|