@plusscommunities/pluss-core-aws 1.5.9-beta.0 → 1.5.10-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,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const indexQueryRecursive = require("../common/indexQueryRecursive");
|
|
2
2
|
|
|
3
3
|
module.exports = async (site, entityKey) => {
|
|
4
4
|
const query = {
|
|
@@ -10,6 +10,5 @@ module.exports = async (site, entityKey) => {
|
|
|
10
10
|
},
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
return Items;
|
|
13
|
+
return await indexQueryRecursive("actionqueue", query);
|
|
15
14
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const indexQueryRecursive = require("../common/indexQueryRecursive");
|
|
2
|
+
|
|
3
|
+
module.exports = async (site, triggerAt) => {
|
|
4
|
+
const query = {
|
|
5
|
+
IndexName: "SiteEntityKeyIndex",
|
|
6
|
+
KeyConditionExpression: "Site = :site and TriggerAt >= :triggerAt",
|
|
7
|
+
ExpressionAttributeValues: {
|
|
8
|
+
":site": site,
|
|
9
|
+
":triggerAt": triggerAt,
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
return await indexQueryRecursive("actionqueue", query);
|
|
14
|
+
};
|
|
@@ -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,42 +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) => _.includes(userIds, u.id));
|
|
144
|
-
};
|
|
145
|
-
|
|
146
108
|
module.exports = async (
|
|
147
109
|
site,
|
|
148
110
|
audienceType,
|
|
@@ -176,20 +138,11 @@ module.exports = async (
|
|
|
176
138
|
audienceTypeSelection,
|
|
177
139
|
site
|
|
178
140
|
);
|
|
179
|
-
const eventMatches = await getEventMatches(users, audienceTypeSelection);
|
|
180
141
|
|
|
181
142
|
// console.log("categoryMatches", categoryMatches);
|
|
182
143
|
// console.log("typeMatches", typeMatches);
|
|
183
144
|
// console.log("tagMatches", tagMatches);
|
|
184
|
-
return _.unionBy(
|
|
185
|
-
categoryMatches,
|
|
186
|
-
typeMatches,
|
|
187
|
-
tagMatches,
|
|
188
|
-
eventMatches,
|
|
189
|
-
"id"
|
|
190
|
-
);
|
|
191
|
-
case "EventAudience":
|
|
192
|
-
return await getEventMatches(users, audienceTypeSelection);
|
|
145
|
+
return _.unionBy(categoryMatches, typeMatches, tagMatches, "id");
|
|
193
146
|
case "Category":
|
|
194
147
|
return await getCategoryMatches(users, audienceTypeSelection, site);
|
|
195
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
|
-
};
|