shuttlepro-shared 1.4.39 → 1.4.41

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,56 @@
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
+ const createUpdateAutomationLogByFilter = async (filter, data) => {
33
+ return await AutomationLog.findOneAndUpdate(filter, data, {
34
+ new: true,
35
+ upsert: true,
36
+ }).exec();
37
+ };
38
+ const deleteAutomationLogById = async (id) => {
39
+ return await AutomationLog.findByIdAndDelete(id).exec();
40
+ };
41
+
42
+ const deleteAutomationLogByFilter = async (filter) => {
43
+ return await AutomationLog.deleteMany(filter).exec();
44
+ };
45
+
46
+ module.exports = {
47
+ getAllAutomationLogs,
48
+ getWorkspaceAutomationLogs,
49
+ getAutomationLogById,
50
+ createAutomationLog,
51
+ createUpdateAutomationLogByFilter,
52
+ updateAutomationLogById,
53
+ updateSingleAutomationLogByFilter,
54
+ deleteAutomationLogById,
55
+ deleteAutomationLogByFilter,
56
+ };
@@ -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,
@@ -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);
@@ -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"],
@@ -349,6 +349,7 @@ const workspaceSchema = new mongoose.Schema(
349
349
  },
350
350
  genericKey: { type: Boolean, default: false },
351
351
  tokens: { type: Number, default: 0 },
352
+ limit: { type: Number, default: 0 },
352
353
  },
353
354
  },
354
355
  { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
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.39",
3
+ "version": "1.4.41",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {