shuttlepro-shared 1.4.33 → 1.4.34

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.
@@ -17,7 +17,7 @@ const customerTimelineRepository = require("./customerTimeline.repository");
17
17
  const shopRepository = require("./shop.repository");
18
18
  const callRepository = require("./call.repository");
19
19
  const interactiveRepository = require("./interactive.repository");
20
-
20
+ const workflowRunRepository = require("./workflowRun.repository");
21
21
  exports.module = {
22
22
  workspaceRepository,
23
23
  integrationRepository,
@@ -38,4 +38,5 @@ exports.module = {
38
38
  shopRepository,
39
39
  callRepository,
40
40
  interactiveRepository,
41
+ workflowRunRepository,
41
42
  };
@@ -0,0 +1,33 @@
1
+ // repositories/workflowRun.repository.js
2
+ const WorkflowRun = require("../models/workflowRun.model");
3
+
4
+ class WorkflowRunRepository {
5
+ async create(payload) {
6
+ return await WorkflowRun.create(payload);
7
+ }
8
+
9
+ async findById(id) {
10
+ return await WorkflowRun.findById(id);
11
+ }
12
+
13
+ async findAll(filter = {}) {
14
+ return await WorkflowRun.find(filter).sort({ createdAt: -1 });
15
+ }
16
+
17
+ async update(id, updates) {
18
+ return await WorkflowRun.findByIdAndUpdate(id, updates, { new: true });
19
+ }
20
+
21
+ async delete(id) {
22
+ return await WorkflowRun.findByIdAndDelete(id);
23
+ }
24
+ async updateOne(filter, updates) {
25
+ return await WorkflowRun.findOneAndUpdate(filter, updates, { new: true });
26
+ }
27
+
28
+ async updateMany(filter, updates) {
29
+ return await WorkflowRun.updateMany(filter, updates);
30
+ }
31
+ }
32
+
33
+ module.exports = new WorkflowRunRepository();
@@ -0,0 +1,48 @@
1
+ const { Schema, model } = require("mongoose");
2
+
3
+ const WorkflowRunSchema = new Schema(
4
+ {
5
+ workspaceId: {
6
+ type: Schema.Types.ObjectId,
7
+ ref: "Workspace",
8
+ default: null,
9
+ },
10
+ businessId: {
11
+ type: String,
12
+ default: "",
13
+ },
14
+ actions: [],
15
+ customerPhoneNumber: {
16
+ type: String,
17
+ default: "",
18
+ },
19
+ initialMessageId: {
20
+ type: Schema.Types.ObjectId,
21
+ ref: "DescriptionTemplate",
22
+ default: null,
23
+ },
24
+ whatsappTemplateId: {
25
+ type: String,
26
+ default: "",
27
+ },
28
+ userResponse: {
29
+ type: String,
30
+ default: "",
31
+ },
32
+ businessPhoneNumberId: {
33
+ type: String,
34
+ default: "",
35
+ },
36
+ workflowId: {
37
+ type: Schema.Types.ObjectId,
38
+ ref: "SocialWorkflow",
39
+ default: null,
40
+ },
41
+ },
42
+ {
43
+ timestamps: true,
44
+ toJSON: true,
45
+ toObject: true,
46
+ }
47
+ );
48
+ module.exports = model("WorkflowRun", WorkflowRunSchema);
package/models.js CHANGED
@@ -102,6 +102,7 @@ const UserWorkflow = require("./models/UserWorkflow");
102
102
  const VariantLocation = require("./models/VariantLocation");
103
103
  const Website = require("./models/Website");
104
104
  const WhatsappFlow = require("./models/WhatsappFlow");
105
+ const WorkflowRun = require("./models/WorkflowRun");
105
106
  const Workflow = require("./models/Workflow");
106
107
  const Workspace = require("./models/Workspace");
107
108
  const Shop = require("./models/Shop");
@@ -214,6 +215,7 @@ module.exports = {
214
215
  WhatsappFlow,
215
216
  Workflow,
216
217
  Workspace,
218
+ WorkflowRun,
217
219
  Shop,
218
220
  Call,
219
221
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shuttlepro-shared",
3
- "version": "1.4.33",
3
+ "version": "1.4.34",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {