@plusscommunities/pluss-maintenance-aws 1.2.2 → 1.2.3

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/getJobTypes.js CHANGED
@@ -1,9 +1,12 @@
1
1
  const config = require("./config.json");
2
+ const _ = require("lodash");
2
3
  const { init } = require("@plusscommunities/pluss-core-aws/config");
3
4
  const { getBody } = require("@plusscommunities/pluss-core-aws/helper");
4
5
  const generateJsonResponse = require("@plusscommunities/pluss-core-aws/helper/generateJsonResponse");
5
6
  const indexQuery = require("@plusscommunities/pluss-core-aws/db/common/indexQuery");
7
+ const updateRef = require("@plusscommunities/pluss-core-aws/db/common/updateRef");
6
8
  const validateSiteAccess = require("@plusscommunities/pluss-core-aws/helper/auth/validateSiteAccess");
9
+ const createGuid = require("@plusscommunities/pluss-core-aws/helper/createGuid");
7
10
 
8
11
  module.exports.getJobTypes = (event, context, callback) => {
9
12
  init(config);
@@ -35,9 +38,20 @@ module.exports.getJobTypes = (event, context, callback) => {
35
38
  };
36
39
 
37
40
  indexQuery("jobTypes", query)
38
- .then((gweg) => {
39
- console.log(gweg);
40
- return callback(null, generateJsonResponse(200, gweg.Items));
41
+ .then((typeRes) => {
42
+ if (!_.isEmpty(typeRes.Items)) {
43
+ return callback(null, generateJsonResponse(200, typeRes.Items));
44
+ }
45
+
46
+ const jobType = {
47
+ id: createGuid().substring(0, 8),
48
+ typeName: "General",
49
+ site: data.site,
50
+ };
51
+
52
+ updateRef("jobTypes", jobType).then(() => {
53
+ return callback(null, generateJsonResponse(200, [jobType]));
54
+ });
41
55
  })
42
56
  .catch((error) => {
43
57
  return callback(
package/package-lock.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plusscommunities/pluss-maintenance-aws",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "lockfileVersion": 1,
5
5
  "requires": true,
6
6
  "dependencies": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plusscommunities/pluss-maintenance-aws",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "Extension package to enable maintenance on Pluss Communities Platform",
5
5
  "scripts": {
6
6
  "gc": "node ../../tools/gc ./",
package/sendJobEmail.js CHANGED
@@ -99,6 +99,9 @@ module.exports = function (job, updated) {
99
99
  getJobEmail(job.site || job.location, job.type)
100
100
  .then((obj) => {
101
101
  const email = obj.email;
102
+ if (_.isEmpty(email)) {
103
+ return;
104
+ }
102
105
 
103
106
  sendEmail(
104
107
  email,