shuttlepro-shared 1.4.38 → 1.4.40

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.
@@ -0,0 +1,50 @@
1
+ const AutomationLog = require("../../models/AutomationLog");
2
+
3
+ const getAllAutomationLogs = async () => {
4
+ return await AutomationLog.find({}).lean().exec();
5
+ };
6
+
7
+ const getWorkspaceAutomationLogs = async (workspaceId) => {
8
+ if (!workspaceId) return [];
9
+ return await AutomationLog.find({ workspaceId }).lean().exec();
10
+ };
11
+
12
+ const getAutomationLogById = async (id) => {
13
+ if (!id) return null;
14
+ return await AutomationLog.findById(id).lean().exec();
15
+ };
16
+
17
+ const createAutomationLog = async (data) => {
18
+ return await AutomationLog.create(data);
19
+ };
20
+
21
+ const updateAutomationLogById = async (id, data) => {
22
+ return await AutomationLog.findByIdAndUpdate(id, data, {
23
+ new: true,
24
+ }).exec();
25
+ };
26
+
27
+ const updateSingleAutomationLogByFilter = async (filter, data) => {
28
+ return await AutomationLog.findOneAndUpdate(filter, data, {
29
+ new: true,
30
+ }).exec();
31
+ };
32
+
33
+ const deleteAutomationLogById = async (id) => {
34
+ return await AutomationLog.findByIdAndDelete(id).exec();
35
+ };
36
+
37
+ const deleteAutomationLogByFilter = async (filter) => {
38
+ return await AutomationLog.deleteMany(filter).exec();
39
+ };
40
+
41
+ module.exports = {
42
+ getAllAutomationLogs,
43
+ getWorkspaceAutomationLogs,
44
+ getAutomationLogById,
45
+ createAutomationLog,
46
+ updateAutomationLogById,
47
+ updateSingleAutomationLogByFilter,
48
+ deleteAutomationLogById,
49
+ deleteAutomationLogByFilter,
50
+ };
@@ -1,3 +1,4 @@
1
+ const automationLogRepository = require("./automationLog.repository");
1
2
  const workspaceRepository = require("./workspace.repository");
2
3
  const integrationRepository = require("./integration.repository");
3
4
  const descriptionTemplateRepository = require("./descriptionTemplates.repository");
@@ -19,6 +20,7 @@ const callRepository = require("./call.repository");
19
20
  const interactiveRepository = require("./interactive.repository");
20
21
  const workflowRunRepository = require("./workflowRun.repository");
21
22
  exports.module = {
23
+ automationLogRepository,
22
24
  workspaceRepository,
23
25
  integrationRepository,
24
26
  descriptionTemplateRepository,
@@ -10,11 +10,6 @@ const AttributeSchema = new Schema(
10
10
  ref: "Workspace",
11
11
  default: null,
12
12
  },
13
- websiteId: {
14
- type: Schema.Types.ObjectId,
15
- ref: "Website",
16
- default: null,
17
- },
18
13
  oldId: { type: String, default: "" },
19
14
  createdBy: { type: Schema.Types.ObjectId, ref: "User", default: null },
20
15
  updatedBy: { type: Schema.Types.ObjectId, ref: "User", default: null },
@@ -0,0 +1,33 @@
1
+ const { model, Schema } = require("mongoose");
2
+ const AutomationLogSchema = new Schema({
3
+ workspaceId: { type: Schema.Types.ObjectId, ref: "Workspace", default: null },
4
+ event: {
5
+ type: String,
6
+ default: "",
7
+ },
8
+ automationId: {
9
+ type: Schema.Types.ObjectId,
10
+ ref: "Automation",
11
+ default: null,
12
+ },
13
+ automationName: {
14
+ type: String,
15
+ default: "",
16
+ },
17
+ platform: {
18
+ type: Schema.Types.Mixed,
19
+ default: "",
20
+ },
21
+ target: {
22
+ type: Schema.Types.Mixed,
23
+ default: "",
24
+ },
25
+ type: {
26
+ type: String,
27
+ enum: ["internal", "external"],
28
+ default: "internal",
29
+ },
30
+ conditionAction: [],
31
+ });
32
+
33
+ module.exports = model("AutomationLog", AutomationLogSchema);
@@ -11,11 +11,6 @@ const CategorySchema = new Schema(
11
11
  ref: "Workspace",
12
12
  default: null,
13
13
  },
14
- websiteId: {
15
- type: Schema.Types.ObjectId,
16
- ref: "Website",
17
- default: null,
18
- },
19
14
  oldId: { type: String, default: "" },
20
15
  webCategoryId: { type: Number, default: null },
21
16
  parentId: { type: Schema.Types.ObjectId, ref: "Category", default: null },
@@ -14,11 +14,6 @@ const CheckpointSchema = new Schema(
14
14
  ref: "Workspace",
15
15
  default: null,
16
16
  },
17
- websiteId: {
18
- type: Schema.Types.ObjectId,
19
- ref: "Website",
20
- default: null,
21
- },
22
17
  },
23
18
  { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
24
19
  );
@@ -18,11 +18,6 @@ const CustomerSchema = new Schema(
18
18
  ref: "Workspace",
19
19
  default: null,
20
20
  },
21
- websiteId: {
22
- type: Schema.Types.ObjectId,
23
- ref: "Website",
24
- default: null,
25
- },
26
21
  isBlackListed: { type: Boolean, default: false },
27
22
  createdBy: {
28
23
  type: Schema.Types.ObjectId,
@@ -1,16 +1,20 @@
1
- const { Schema, Types, model } = require("mongoose");
1
+ const { Schema, model } = require("mongoose");
2
2
 
3
3
  const ActionSchema = new Schema({
4
4
  type: {
5
5
  type: String,
6
6
  default: "",
7
7
  },
8
- interactiveId: { type: Types.ObjectId, ref: "Interactive", default: null },
8
+ interactiveId: {
9
+ type: Schema.Types.ObjectId,
10
+ ref: "Interactive",
11
+ default: null,
12
+ },
9
13
  value: { type: Schema.Types.Mixed, default: "" },
10
14
  });
11
15
  const InteractiveSchema = new Schema({
12
16
  name: { type: String, default: "" },
13
- workspaceId: { type: Types.ObjectId, ref: "Workspace", default: null },
17
+ workspaceId: { type: Schema.Types.ObjectId, ref: "Workspace", default: null },
14
18
  type: {
15
19
  type: String,
16
20
  enum: ["button", "list"],
@@ -14,11 +14,6 @@ const LocationSchema = new Schema(
14
14
  oldId: { type: String, default: "" },
15
15
  webLocationId: { type: Number, default: null },
16
16
  bcLocationId: { type: String, default: "" },
17
- websiteId: {
18
- type: Schema.Types.ObjectId,
19
- ref: "Website",
20
- default: null,
21
- },
22
17
  workspaceId: {
23
18
  type: Schema.Types.ObjectId,
24
19
  ref: "Workspace",
package/models/Order.js CHANGED
@@ -103,11 +103,6 @@ const OrderSchema = new Schema(
103
103
  ref: "Workspace",
104
104
  default: null,
105
105
  },
106
- websiteId: {
107
- type: Schema.Types.ObjectId,
108
- ref: "Website",
109
- default: null,
110
- },
111
106
  orderType: { type: String, default: "" },
112
107
  barCode: { type: String, default: "" },
113
108
  quantity: { type: Number, default: 0 },
@@ -228,7 +223,6 @@ const markOrUnMarkOrderAsDuplicate = async (doc) => {
228
223
  const phoneRegex = getPhoneRegex(doc?.customerPhone);
229
224
  let orders = await Order.find({
230
225
  workspaceId: doc?.workspaceId,
231
- websiteId: doc?.websiteId,
232
226
  isDeleted: false,
233
227
  statusType: "pending",
234
228
  customerPhone: phoneRegex,
@@ -20,11 +20,6 @@ const OrderPdfScehma = new mongoose.Schema(
20
20
  ref: "Workspace",
21
21
  default: null,
22
22
  },
23
- websiteId: {
24
- type: Schema.Types.ObjectId,
25
- ref: "Website",
26
- default: null,
27
- },
28
23
  createdBy: { type: Schema.Types.ObjectId, ref: "User", default: null },
29
24
  updatedBy: { type: Schema.Types.ObjectId, ref: "User", default: null },
30
25
  },
@@ -31,11 +31,6 @@ const OrderProductSchema = new Schema(
31
31
  ref: "Workspace",
32
32
  default: null,
33
33
  },
34
- websiteId: {
35
- type: Schema.Types.ObjectId,
36
- ref: "Website",
37
- default: null,
38
- },
39
34
  },
40
35
  { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
41
36
  );
package/models/Product.js CHANGED
@@ -31,11 +31,6 @@ const ProductSchema = new Schema(
31
31
  type: Schema.Types.ObjectId,
32
32
  ref: "Workspace",
33
33
  default: null,
34
- },
35
- websiteId: {
36
- type: Schema.Types.ObjectId,
37
- ref: "Website",
38
- default: null,
39
34
  },
40
35
  storeType: { type: String, default: "LOCAL" },
41
36
  isDeleted: { type: Boolean, default: false },
@@ -22,11 +22,6 @@ const ProductAttachmentSchema = new Schema(
22
22
  ref: "Workspace",
23
23
  default: null,
24
24
  },
25
- websiteId: {
26
- type: Schema.Types.ObjectId,
27
- ref: "Website",
28
- default: null,
29
- },
30
25
  height: { type: Number, default: 0 },
31
26
  variantIds: [
32
27
  { type: Schema.Types.ObjectId, ref: "ProductVariant", default: null },
@@ -16,11 +16,6 @@ const ProductAttributeSchema = new mongoose.Schema(
16
16
  ref: "Workspace",
17
17
  default: null,
18
18
  },
19
- websiteId: {
20
- type: Schema.Types.ObjectId,
21
- ref: "Website",
22
- default: null,
23
- },
24
19
  isDeleted: { type: Boolean, default: false },
25
20
  position: { type: String, default: "1" },
26
21
  },
@@ -11,11 +11,6 @@ const ProductCategorySchema = new Schema(
11
11
  ref: "Workspace",
12
12
  default: null,
13
13
  },
14
- websiteId: {
15
- type: Schema.Types.ObjectId,
16
- ref: "Website",
17
- default: null,
18
- },
19
14
  createdBy: { type: Schema.Types.ObjectId, ref: "User", default: null },
20
15
  updatedBy: { type: Schema.Types.ObjectId, ref: "User", default: null },
21
16
  isDeleted: { type: Boolean, default: false },
@@ -11,11 +11,6 @@ const ProductTagSchema = new Schema(
11
11
  ref: "Workspace",
12
12
  default: null,
13
13
  },
14
- websiteId: {
15
- type: Schema.Types.ObjectId,
16
- ref: "Website",
17
- default: null,
18
- },
19
14
  createdBy: { type: Schema.Types.ObjectId, ref: "User", default: null },
20
15
  updatedBy: { type: Schema.Types.ObjectId, ref: "User", default: null },
21
16
  isDeleted: { type: Boolean, default: false },
@@ -17,11 +17,6 @@ const ProductVariantSchema = new Schema(
17
17
  ref: "Workspace",
18
18
  default: null,
19
19
  },
20
- websiteId: {
21
- type: Schema.Types.ObjectId,
22
- ref: "Website",
23
- default: null,
24
- },
25
20
  webVariantId: { type: Number, default: null },
26
21
  inventoryPolicy: { type: String, default: "deny" }, //deny,continue
27
22
  taxable: { type: Boolean, default: false },
package/models/Tag.js CHANGED
@@ -8,11 +8,6 @@ const TagSchema = new Schema(
8
8
  ref: "Workspace",
9
9
  default: null,
10
10
  },
11
- websiteId: {
12
- type: Schema.Types.ObjectId,
13
- ref: "Website",
14
- default: null,
15
- },
16
11
  oldId: { type: String, default: "" },
17
12
  webTagId: { type: Number, default: "" },
18
13
  createdBy: { type: Schema.Types.ObjectId, ref: "User", default: null },
@@ -13,11 +13,6 @@ const VariantLocationSchema = new Schema(
13
13
  ref: "Workspace",
14
14
  default: null,
15
15
  },
16
- websiteId: {
17
- type: Schema.Types.ObjectId,
18
- ref: "Website",
19
- default: null,
20
- },
21
16
  productId: { type: Schema.Types.ObjectId, ref: "Product", default: null },
22
17
  locationId: { type: Schema.Types.ObjectId, ref: "Location", default: null },
23
18
  webVariantLocationId: { type: Number, default: null },
@@ -12,6 +12,10 @@ const WorkflowRunSchema = new Schema(
12
12
  default: "",
13
13
  },
14
14
  actions: [],
15
+ customerName: {
16
+ type: String,
17
+ default: "",
18
+ },
15
19
  customerPhoneNumber: {
16
20
  type: String,
17
21
  default: "",
package/models.js CHANGED
@@ -7,6 +7,7 @@ const AllPostScheduleSchema = require("./models/AllPostSchedule");
7
7
  const Assignment = require("./models/Assignment");
8
8
  const Attribute = require("./models/Attribute");
9
9
  const Automation = require("./models/Automation");
10
+ const AutomationLog = require("./models/AutomationLog");
10
11
  const AutoSchedulerSchema = require("./models/AutoScheduler");
11
12
  const BusinessDistribution = require("./models/BusinessDistribution");
12
13
  const BusinessRule = require("./models/BusinessRule");
@@ -118,6 +119,7 @@ module.exports = {
118
119
  Assignment,
119
120
  Attribute,
120
121
  Automation,
122
+ AutomationLog,
121
123
  AutoSchedulerSchema,
122
124
  BusinessDistribution,
123
125
  BusinessRule,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shuttlepro-shared",
3
- "version": "1.4.38",
3
+ "version": "1.4.40",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {