shuttlepro-shared 1.3.39 → 1.3.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.
Files changed (73) hide show
  1. package/common/repositories/customerProfile.repository.js +14 -83
  2. package/common/repositories/userRole.repository.js +2 -5
  3. package/config/redis.js +73 -72
  4. package/middlewares/checkPermission/index.js +23 -36
  5. package/models/ActivityLogs.js +0 -1
  6. package/models/AgentActivity.js +4 -5
  7. package/models/Card.js +1 -50
  8. package/models/Chatbot.js +1 -1
  9. package/models/Column.js +0 -6
  10. package/models/Conversation.js +0 -40
  11. package/models/Customer.js +1 -2
  12. package/models/Integration.js +0 -6
  13. package/models/Order.js +0 -11
  14. package/models/Profile.js +1 -3
  15. package/models/Workspace.js +4 -78
  16. package/models.js +49 -168
  17. package/package.json +1 -1
  18. package/models/Activity.js +0 -28
  19. package/models/Attribute.js +0 -130
  20. package/models/Automation.js +0 -242
  21. package/models/BusinessRule.js +0 -16
  22. package/models/BusinessRuleHelper.js +0 -13
  23. package/models/Catalogue.js +0 -22
  24. package/models/Category.js +0 -129
  25. package/models/ChatMemberSession.js +0 -21
  26. package/models/ChatMessage.js +0 -43
  27. package/models/Color.js +0 -10
  28. package/models/CustomerCheckpoint.js +0 -21
  29. package/models/DeviceInfo.js +0 -13
  30. package/models/Email.js +0 -21
  31. package/models/EmailMessage.js +0 -30
  32. package/models/EmailNotification.js +0 -17
  33. package/models/EscalationConfiguration.js +0 -123
  34. package/models/EscalationManager.js +0 -50
  35. package/models/Faq.js +0 -29
  36. package/models/FeedbackResponse.js +0 -72
  37. package/models/FormTemplate.js +0 -27
  38. package/models/InternalComments.js +0 -27
  39. package/models/InternalThreads.js +0 -20
  40. package/models/JobDesign.js +0 -32
  41. package/models/JobQueue.js +0 -17
  42. package/models/LabelsPdf.js +0 -12
  43. package/models/Layout.js +0 -12
  44. package/models/LoadSheet.js +0 -31
  45. package/models/Location.js +0 -147
  46. package/models/Logo.js +0 -11
  47. package/models/MailGroup.js +0 -21
  48. package/models/Notification.js +0 -32
  49. package/models/OrderPdf.js +0 -29
  50. package/models/PostsAutomation.js +0 -66
  51. package/models/Product.js +0 -336
  52. package/models/ProductAttachment.js +0 -158
  53. package/models/ProductAttribute.js +0 -140
  54. package/models/ProductCategory.js +0 -128
  55. package/models/ProductLabels.js +0 -11
  56. package/models/ProductShopify.js +0 -13
  57. package/models/ProductTag.js +0 -124
  58. package/models/ProductVariant.js +0 -156
  59. package/models/ServiceUsage.js +0 -26
  60. package/models/ShipperSetting.js +0 -24
  61. package/models/SocialGroup.js +0 -127
  62. package/models/SocialPost.js +0 -40
  63. package/models/SocialProfile.js +0 -56
  64. package/models/Story.js +0 -86
  65. package/models/Tag.js +0 -77
  66. package/models/Template.js +0 -76
  67. package/models/TemplateFrame.js +0 -55
  68. package/models/TemplateTag.js +0 -10
  69. package/models/UserGuide.js +0 -21
  70. package/models/UserSession.js +0 -47
  71. package/models/VariantLocation.js +0 -145
  72. package/models/WhatsappFlow.js +0 -29
  73. package/models/Workflow.js +0 -34
@@ -1,123 +0,0 @@
1
- const mongoose = require("mongoose");
2
- const { Schema } = mongoose;
3
-
4
- const EscalationLevelSchema = new Schema({
5
- _id: false,
6
- threshold: {
7
- type: Number,
8
- required: true,
9
- },
10
- actions: {
11
- labels: [
12
- {
13
- type: Schema.Types.ObjectId,
14
- ref: "Label",
15
- },
16
- ],
17
- memberIds: [
18
- {
19
- type: Schema.Types.ObjectId,
20
- ref: "User",
21
- },
22
- ],
23
- ticketPriority: {
24
- type: String,
25
- enum: ["high", "medium", "low", ""],
26
- default: "",
27
- },
28
- notification: {
29
- action: {
30
- type: String,
31
- enum: ["email", "systemNotification", "both"],
32
- default: "systemNotification",
33
- },
34
- integrationId: {
35
- type: Schema.Types.ObjectId,
36
- ref: "Integration",
37
- },
38
- templateId: {
39
- type: Schema.Types.ObjectId,
40
- ref: "DescriptionTemplate",
41
- },
42
- memberEmails: [
43
- {
44
- type: String,
45
- },
46
- ],
47
- },
48
- },
49
- });
50
-
51
- const EscalationGroupSchema = new Schema({
52
- conditionalMatch: {
53
- type: String,
54
- enum: ["any", "all"],
55
- default: "any",
56
- },
57
- contains: {
58
- type: String,
59
- enum: ["equalTo", "contains", "notEqualTo", "notContains", ""],
60
- default: "",
61
- },
62
- conditions: [
63
- {
64
- _id: false,
65
- type: {
66
- type: String,
67
- required: true,
68
- enum: ["status", "label", "formBuilder"],
69
- },
70
- values: [
71
- {
72
- type: String,
73
- },
74
- ],
75
- subValues: [
76
- {
77
- type: String,
78
- },
79
- ],
80
- //open/processing/hold/close/isCritical,assignedChat
81
- },
82
- ],
83
- levels: [EscalationLevelSchema], // Each group contains multiple escalation levels
84
- });
85
-
86
- const EscalationConfigurationSchema = new Schema(
87
- {
88
- title: {
89
- type: String,
90
- required: true,
91
- },
92
- isDeleted: {
93
- type: Boolean,
94
- default: false,
95
- },
96
- type: {
97
- type: String,
98
- enum: ["conversation", "ticket", "both"],
99
- default: "conversation",
100
- },
101
- workspaceId: {
102
- type: String,
103
- default: "",
104
- },
105
- createdBy: {
106
- type: Schema.Types.ObjectId,
107
- ref: "User",
108
- },
109
- enabled: {
110
- type: Boolean,
111
- default: true,
112
- },
113
- group: [EscalationGroupSchema], // Array of groups, each containing multiple levels
114
- },
115
- { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
116
- );
117
-
118
- const EscalationConfiguration = mongoose.model(
119
- "EscalationConfiguration",
120
- EscalationConfigurationSchema
121
- );
122
-
123
- module.exports = { EscalationConfiguration };
@@ -1,50 +0,0 @@
1
- const mongoose = require("mongoose");
2
- const { Schema } = mongoose;
3
-
4
- const EscalationManagerSchema = new Schema(
5
- {
6
- type: {
7
- type: String,
8
- required: true,
9
- enum: ["conversation", "ticket"],
10
- },
11
- refId: {
12
- type: String,
13
- required: true,
14
- },
15
- escalationId: {
16
- type: Schema.Types.ObjectId,
17
- ref: "Escalation",
18
- },
19
- groupId: {
20
- type: String,
21
- },
22
- status: {
23
- type: String,
24
- enum: ["pending", "processing", "close"],
25
- },
26
- managerStatus: [
27
- {
28
- escalationLevel: {
29
- type: Number,
30
- },
31
- status: {
32
- type: String,
33
- enum: ["pending", "done", "failed"],
34
- },
35
- },
36
- ],
37
- workspaceId: {
38
- type: Schema.Types.ObjectId,
39
- ref: "Workspace",
40
- },
41
- },
42
- { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
43
- );
44
-
45
- const EscalationManager = mongoose.model(
46
- "EscalationManager",
47
- EscalationManagerSchema
48
- );
49
-
50
- module.exports = EscalationManager;
package/models/Faq.js DELETED
@@ -1,29 +0,0 @@
1
- const mongoose = require("mongoose");
2
- const { Schema } = mongoose;
3
-
4
- const FaqItemSchema = new Schema({
5
- question: { type: String, required: true },
6
- answer: { type: String, required: true },
7
- });
8
-
9
- const FaqSchema = new Schema(
10
- {
11
- name: {
12
- type: String,
13
- required: true,
14
- },
15
- list: {
16
- type: [FaqItemSchema],
17
- required: true,
18
- },
19
- workspaceId: {
20
- type: Schema.Types.ObjectId,
21
- ref: "Workspace",
22
- },
23
- },
24
- { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
25
- );
26
-
27
- const Faq = mongoose.model("Faq", FaqSchema);
28
-
29
- module.exports = Faq;
@@ -1,72 +0,0 @@
1
- const mongoose = require("mongoose");
2
- const { Schema } = mongoose;
3
- const { v4: uuidv4 } = require("uuid");
4
-
5
- const FeedbackResponseSchema = new Schema(
6
- {
7
- paramId: {
8
- type: String,
9
- default: uuidv4(),
10
- },
11
- type: {
12
- type: String,
13
- enum: ["conversation", "order"],
14
- default: "conversation",
15
- },
16
- refId: {
17
- type: String,
18
- default: "",
19
- },
20
- workspaceId: {
21
- type: String,
22
- default: "",
23
- },
24
- agentId: {
25
- type: String,
26
- default: "",
27
- },
28
- feedbackFormId: {
29
- type: String,
30
- default: "",
31
- },
32
- data: {
33
- type: Schema.Types.Mixed,
34
- default: {},
35
- },
36
- responseAdded: {
37
- type: Boolean,
38
- default: false,
39
- },
40
- customerInfo: {
41
- type: Schema.Types.Mixed,
42
- default: {},
43
- },
44
- platformInfo: {
45
- type: Schema.Types.Mixed,
46
- default: {},
47
- },
48
- timeStamp: {
49
- type: Date,
50
- default: Date.now,
51
- },
52
-
53
- workspaceId: {
54
- type: String,
55
- default: "",
56
- },
57
- feedbackFormId: {
58
- type: String,
59
- default: "",
60
- },
61
- qr: {
62
- link: {
63
- type: String,
64
- default: "",
65
- trim: true,
66
- },
67
- },
68
- },
69
- { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
70
- );
71
-
72
- module.exports = mongoose.model("FeedbackResponse", FeedbackResponseSchema);
@@ -1,27 +0,0 @@
1
- const mongoose = require("mongoose");
2
-
3
- const FormTemplateSchema = new mongoose.Schema(
4
- {
5
- type: {
6
- type: String,
7
- required: true,
8
- enum: ["feedback", "ticket"],
9
- },
10
- subType: {
11
- type: String,
12
- enum: ["formBuilder","complaint", "order", "ticket", "product"],
13
- },
14
- workspaceId: {
15
- type: String,
16
- default: "",
17
- },
18
- body: {
19
- type: mongoose.Schema.Types.Mixed,
20
- default: {},
21
- },
22
- },
23
- { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
24
- );
25
-
26
- const FormTemplate = mongoose.model("FormTemplate", FormTemplateSchema);
27
- module.exports = FormTemplate;
@@ -1,27 +0,0 @@
1
- const mongoose = require("mongoose");
2
- const { Schema } = mongoose;
3
- const InternalCommentSchema = new Schema(
4
- {
5
- comment: { type: String, default: "" },
6
- item_id: { type: String, default: "" },
7
- sender_profile_url: { type: String, default: "" },
8
- workspace_id: { type: String, default: "" },
9
- sender_name: { type: String, default: "" },
10
- senderId: { type: String, default: "" },
11
- commentType: { type: String, default: "" },
12
- mention_id: [{ id: String, name: String }],
13
- pageId: { type: String, default: "" },
14
- attachments: [],
15
- },
16
- { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
17
- );
18
- InternalCommentSchema.virtual("internalThreads", {
19
- ref: "InternalThreads",
20
- localField: "_id",
21
- foreignField: "internalCommentId",
22
- });
23
- const InternalComment = mongoose.model(
24
- "InternalComment",
25
- InternalCommentSchema
26
- );
27
- module.exports = InternalComment;
@@ -1,20 +0,0 @@
1
- const mongoose = require("mongoose");
2
- const { Schema } = mongoose;
3
- const InternalThreadsSchema = new Schema(
4
- {
5
- internalCommentId: { type: Schema.Types.ObjectId, ref: "InternalComment" },
6
- comment: { type: String, default: "" },
7
- sender_name: { type: String, default: "" },
8
- senderId: { type: String, default: "" },
9
- sender_profile_url: { type: String, default: "" },
10
- mention_id: [{ id: String, name: String }],
11
- pageId: { type: String, default: "" },
12
- attachments: [],
13
- },
14
- { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
15
- );
16
- const InternalThreads = mongoose.model(
17
- "InternalThreads",
18
- InternalThreadsSchema
19
- );
20
- module.exports = InternalThreads;
@@ -1,32 +0,0 @@
1
- const mongoose = require("mongoose");
2
- const { Schema } = mongoose;
3
-
4
- const jobDesignSchema = new mongoose.Schema(
5
- {
6
- name: { type: String, default: "" },
7
- products: { type: Number, default: 0 },
8
- productIds: [],
9
- status: { type: String, default: "processing" },
10
- data: [
11
- {
12
- url: { type: String, default: "" },
13
- bucket: { type: String, default: "" },
14
- key: { type: String, default: "" },
15
- },
16
- ],
17
- downloads: [],
18
- tagName: { type: String, default: "" },
19
- tagId: { type: String, default: "" },
20
- userId: { type: Schema.Types.ObjectId, ref: "User" },
21
- userName: { type: String, default: "" },
22
- organizationId: { type: Number, default: 0 },
23
- workspaceId: { type: Schema.Types.ObjectId, ref: "Workspace" },
24
- templateId: {
25
- type: Schema.Types.ObjectId,
26
- ref: "Template",
27
- },
28
- },
29
- { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
30
- );
31
-
32
- module.exports = mongoose.model("JobDesign", jobDesignSchema);
@@ -1,17 +0,0 @@
1
- const mongoose = require("mongoose");
2
- const { Schema } = mongoose;
3
- const jobQueueSchema = new mongoose.Schema(
4
- {
5
- jobId: { type: String },
6
- templateData: { type: Object },
7
- imageUrl: { type: String },
8
- imageId: { type: String, default: "" },
9
- workspaceId: { type: Schema.Types.ObjectId, ref: "Product" },
10
- status: { type: String, default: "Processing" },
11
- message: { type: String, default: "" },
12
- attempt: { type: Number, default: 0 },
13
- },
14
- { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
15
- );
16
-
17
- module.exports = mongoose.model("JobQueue", jobQueueSchema);
@@ -1,12 +0,0 @@
1
- const mongoose = require("mongoose");
2
-
3
- const LabelsPdfSchema = new mongoose.Schema(
4
- {
5
- url: { type: String, default: "" },
6
- organizationId: { type: Number, default: 0 },
7
- storeId: { type: Number, default: 0 }
8
- },
9
- { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
10
- );
11
-
12
- module.exports = mongoose.model("LabelsPdf", LabelsPdfSchema);
package/models/Layout.js DELETED
@@ -1,12 +0,0 @@
1
- const mongoose = require("mongoose");
2
-
3
- const layoutSchema = new mongoose.Schema(
4
- {
5
- name: { type: String, default: "" },
6
- height: { type: Number, default: 0 },
7
- width: { type: Number, default: 0 }
8
- },
9
- { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
10
- );
11
-
12
- module.exports = mongoose.model("Layout", layoutSchema);
@@ -1,31 +0,0 @@
1
- const mongoose = require("mongoose");
2
- const { Schema } = mongoose;
3
-
4
- const loadSheetSchema = new mongoose.Schema(
5
- {
6
- uuid: { type: String, default: "" },
7
- courierName: { type: String, default: "" },
8
- courierId: { type: String, default: "" },
9
- orders: [
10
- {
11
- orderId: {
12
- type: Schema.Types.ObjectId,
13
- ref: "Order",
14
- default: null,
15
- },
16
- },
17
- ],
18
- workspaceId: {
19
- type: Schema.Types.ObjectId,
20
- ref: "Workspace",
21
- default: null,
22
- },
23
- isDeleted: { type: Boolean, default: false },
24
- generatedBy: { type: Schema.Types.ObjectId, ref: "User", default: null },
25
- createdBy: { type: Schema.Types.ObjectId, ref: "User", default: null },
26
- updatedBy: { type: Schema.Types.ObjectId, ref: "User", default: null },
27
- },
28
- { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
29
- );
30
-
31
- module.exports = mongoose.model("LoadSheet", loadSheetSchema);
@@ -1,147 +0,0 @@
1
- const mongoose = require("mongoose");
2
- const { Schema } = mongoose;
3
- const LocationSchema = new Schema(
4
- {
5
- isDefault: { type: Boolean, default: false },
6
- address1: { type: String, default: "" },
7
- address2: { type: String, default: "" },
8
- city: { type: String, default: "" },
9
- zip: { type: String, default: "" },
10
- province: { type: String, default: "" },
11
- country: { type: String, default: "" },
12
- phone: { type: String, default: "" },
13
- active: { type: Boolean, default: true },
14
- oldId: { type: String, default: "" },
15
- webLocationId: { type: Number, default: null },
16
- bcLocationId: { type: String, default: "" },
17
- workspaceId: {
18
- type: Schema.Types.ObjectId,
19
- ref: "Workspace",
20
- default: null,
21
- },
22
- legacy: { type: Boolean, default: false },
23
- name: { type: String, default: "" },
24
- isDeleted: { type: Boolean, default: false },
25
- createdBy: { type: Schema.Types.ObjectId, ref: "User", default: null },
26
- updatedBy: { type: Schema.Types.ObjectId, ref: "User", default: null },
27
- },
28
- { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
29
- );
30
-
31
- LocationSchema.virtual("variantLocations", {
32
- ref: "VariantLocation",
33
- localField: "_id",
34
- foreignField: "locationId",
35
- });
36
-
37
- const Location = mongoose.model("Location", LocationSchema);
38
-
39
- const createNewLocation = async (locationData) => {
40
- try {
41
- return await Location.create(locationData);
42
- } catch (error) {
43
- console.log(error);
44
- return null;
45
- }
46
- };
47
-
48
- const findLocationById = async (locationId) => {
49
- try {
50
- return await Location.findById(locationId);
51
- } catch (error) {
52
- console.log(error);
53
- return null;
54
- }
55
- };
56
-
57
- const updateLocationById = async (criteria, updateData, options) => {
58
- try {
59
- return await Location.findByIdAndUpdate(criteria, updateData, options);
60
- } catch (error) {
61
- console.log(error);
62
- return null;
63
- }
64
- };
65
- const updateLocation = async (criteria, updateData, options) => {
66
- try {
67
- return await Location.findOneAndUpdate(criteria, updateData, options);
68
- } catch (error) {
69
- console.log(error);
70
- return null;
71
- }
72
- };
73
-
74
- const findAndUpdateLocation = async (criteria, data, options) => {
75
- try {
76
- return await Location.findOneAndUpdate(criteria, data, options);
77
- } catch (error) {
78
- console.log(error);
79
- return null;
80
- }
81
- };
82
- const deleteLocationById = async (locationId) => {
83
- try {
84
- return await Location.findByIdAndDelete(locationId);
85
- } catch (error) {
86
- console.log(error);
87
- return null;
88
- }
89
- };
90
-
91
- const findLocation = async (criteria) => {
92
- try {
93
- return await Location.findOne(criteria);
94
- } catch (error) {
95
- console.log(error);
96
- return null;
97
- }
98
- };
99
-
100
- const findLocations = async (criteria) => {
101
- try {
102
- return await Location.find(criteria);
103
- } catch (error) {
104
- console.log(error);
105
- return [];
106
- }
107
- };
108
-
109
- const locationsByAggregation = async (aggregate = []) => {
110
- try {
111
- let locations = await Location.aggregate(aggregate);
112
- return locations;
113
- } catch (err) {
114
- return [];
115
- }
116
- };
117
-
118
- const locationsUpdateMany = async (criteria, updateData, options = {}) => {
119
- try {
120
- return await Location.updateMany(criteria, updateData, options);
121
- } catch (error) {
122
- return null;
123
- }
124
- };
125
-
126
- const insertLocations = async (locations) => {
127
- try {
128
- return await Location.insertMany(locations);
129
- } catch (err) {
130
- return [];
131
- }
132
- };
133
-
134
- module.exports = {
135
- Location,
136
- createNewLocation,
137
- findLocationById,
138
- updateLocationById,
139
- updateLocation,
140
- deleteLocationById,
141
- findLocation,
142
- findLocations,
143
- locationsByAggregation,
144
- locationsUpdateMany,
145
- insertLocations,
146
- findAndUpdateLocation,
147
- };
package/models/Logo.js DELETED
@@ -1,11 +0,0 @@
1
- const mongoose = require("mongoose");
2
-
3
- const logoSchema = new mongoose.Schema(
4
- {
5
- url: { type: String, default: "" },
6
- workspaceId: { type: String, default: "" },
7
- },
8
- { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
9
- );
10
-
11
- module.exports = mongoose.model("Logo", logoSchema);
@@ -1,21 +0,0 @@
1
- const mongoose = require("mongoose");
2
- const { Schema } = mongoose;
3
-
4
- const MailGroupSchema = new Schema(
5
- {
6
- name: { type: String, default: "" },
7
- emailIds: [
8
- {
9
- emailId: {
10
- type: Schema.Types.ObjectId,
11
- ref: "Email",
12
- },
13
- },
14
- ],
15
- workspaceId: { type: String, default: "" },
16
- },
17
- { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
18
- );
19
-
20
- const MailGroup = mongoose.model("MailGroup", MailGroupSchema);
21
- module.exports = MailGroup;
@@ -1,32 +0,0 @@
1
- const mongoose = require("mongoose");
2
- const { Schema } = mongoose;
3
-
4
- const NotificationSchema = new Schema(
5
- {
6
- type: { type: String, default: "" },
7
- isRead: { type: Boolean, default: false },
8
- operation: { type: String, default: "" },
9
- actionId: { type: String, default: "" },
10
- workspaceId: { type: String, default: "" },
11
- workspaceName: { type: String, default: "" },
12
- message: { type: String, default: "" },
13
- email: { type: String, default: "" },
14
- userId: { type: String, default: "" },
15
- data: { type: mongoose.Schema.Types.Mixed },
16
- isDeleted: { type: Boolean, default: false },
17
- alertShow: { type: Boolean, default: false },
18
- routes: {
19
- routeType: { type: String, default: "" },
20
- id: { type: String, default: "" },
21
- query: { type: Boolean, default: false },
22
- queryData: { type: String, default: "" },
23
- },
24
- permissions: [],
25
- role: [String],
26
- },
27
- { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
28
- );
29
-
30
- const Notification = mongoose.model("Notification", NotificationSchema);
31
-
32
- module.exports = Notification;