@plusscommunities/pluss-core-aws 1.4.1 → 1.4.2-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.
@@ -7,7 +7,7 @@ module.exports = async (rowId, update) => {
7
7
  const { Updated } = update;
8
8
  if (!rowId) {
9
9
  rowId = uuid.v1();
10
- update.Created = now;
10
+ if (!update.Created) update.Created = now;
11
11
  } else {
12
12
  if (!Updated) update.Updated = now;
13
13
  }
@@ -0,0 +1,23 @@
1
+ const _ = require("lodash");
2
+ const { log } = require("../../helper");
3
+ const indexQuery = require("../common/indexQuery");
4
+
5
+ module.exports = async (email) => {
6
+ return new Promise(async (resolve, reject) => {
7
+ const logId = log("getUserByEmail", "email", email);
8
+ const query = {
9
+ IndexName: "UserValidateIndexEmail",
10
+ KeyConditionExpression: "email = :email",
11
+ ExpressionAttributeValues: {
12
+ ":email": email,
13
+ },
14
+ };
15
+ const qResult = await indexQuery("users", query);
16
+ if (_.isEmpty(qResult.Items)) {
17
+ log("getUserByEmail", "result", null, logId);
18
+ return resolve(null);
19
+ }
20
+ log("getUserByEmail", "result", qResult.Items[0], logId);
21
+ return resolve(qResult.Items[0]);
22
+ });
23
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plusscommunities/pluss-core-aws",
3
- "version": "1.4.1",
3
+ "version": "1.4.2-beta.0",
4
4
  "description": "Core extension package for Pluss Communities platform",
5
5
  "scripts": {
6
6
  "betapatch": "npm version prepatch --preid=beta",