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,242 +0,0 @@
1
- const { repositories } = require("shuttlepro-shared");
2
- const mongoose = require("mongoose");
3
- const { Schema } = mongoose;
4
-
5
- const userJoin = {
6
- type: Schema.Types.ObjectId,
7
- ref: "User",
8
- default: null,
9
- };
10
-
11
- const descriptionJoin = {
12
- type: Schema.Types.ObjectId,
13
- ref: "DescriptionTemplate",
14
- default: null,
15
- };
16
-
17
- const defaultStringType = {
18
- type: String,
19
- default: "",
20
- };
21
-
22
- const AutomationAction = new Schema({
23
- addLabels: [
24
- {
25
- type: Schema.Types.ObjectId,
26
- ref: "Label",
27
- default: null,
28
- },
29
- ],
30
- autoAssign: {
31
- enabled: { type: Boolean, default: false },
32
- membersId: [userJoin],
33
- },
34
- autoReply: {
35
- enabled: { type: Boolean, default: false },
36
- templateId: descriptionJoin,
37
- delay: defaultStringType,
38
- },
39
- commentReplyPrivately: {
40
- enabled: { type: Boolean, default: false },
41
- templateId: descriptionJoin,
42
- delay: defaultStringType,
43
- },
44
- conversationReply: {
45
- enabled: { type: Boolean, default: false },
46
- templateId: descriptionJoin,
47
- delay: defaultStringType,
48
- },
49
- sendCollection: {
50
- enabled: { type: Boolean, default: false },
51
- template: { type: Object, default: null },
52
- delay: defaultStringType,
53
- },
54
- autoTicket: {
55
- enabled: { type: Boolean, default: false },
56
- title: defaultStringType,
57
- labelIds: [
58
- {
59
- type: Schema.Types.ObjectId,
60
- ref: "Label",
61
- default: null,
62
- },
63
- ],
64
- alreadyTicketTemplateId: descriptionJoin,
65
- templateId: descriptionJoin,
66
- template: defaultStringType,
67
- columnId: {
68
- type: mongoose.Schema.Types.ObjectId,
69
- ref: "Column",
70
- },
71
- priority: {
72
- type: String,
73
- enum: ["high", "medium", "low"],
74
- },
75
- ticketDue: defaultStringType,
76
- assignId: {
77
- type: mongoose.Schema.Types.Mixed,
78
- default: null,
79
- },
80
- members: [userJoin],
81
- },
82
- escalation: {
83
- enabled: { type: Boolean, default: false },
84
- escalationIds: {
85
- type: Schema.Types.ObjectId,
86
- ref: "EscalationConfiguration",
87
- },
88
- },
89
- notification: {
90
- enabled: { type: Boolean, default: false },
91
- notificationMemberIds: [userJoin],
92
- },
93
- orderConfirmation: {
94
- enabled: { type: Boolean, default: false },
95
- integrationId: {
96
- id: defaultStringType,
97
- type: defaultStringType,
98
- accountTitle: defaultStringType,
99
- businessId: defaultStringType,
100
- name: defaultStringType,
101
- },
102
- workflow: {},
103
- otherConfirmationMode: {
104
- type: String,
105
- enum: ["ivr", "sms", ""],
106
- default: "",
107
- },
108
- },
109
- orderPublish: {
110
- enabled: { type: Boolean, default: false },
111
- integrationId: {
112
- id: defaultStringType,
113
- type: defaultStringType,
114
- accountTitle: defaultStringType,
115
- businessId: defaultStringType,
116
- name: defaultStringType,
117
- },
118
- workflow: {},
119
- otherConfirmationMode: {
120
- type: String,
121
- enum: ["ivr", "sms", ""],
122
- default: "",
123
- },
124
- },
125
- orderReview: {
126
- enabled: { type: Boolean, default: false },
127
- integrationId: {
128
- id: defaultStringType,
129
- type: defaultStringType,
130
- accountTitle: defaultStringType,
131
- businessId: defaultStringType,
132
- name: defaultStringType,
133
- },
134
- flow: {},
135
- },
136
- chatbot: {
137
- enabled: { type: Boolean, default: false },
138
- id: defaultStringType,
139
- },
140
- });
141
- const AutomationCondition = new Schema({
142
- criteriaType: {
143
- type: {
144
- type: String,
145
- required: true,
146
- enum: [
147
- "sender",
148
- "content",
149
- "order",
150
- "time",
151
- "ticketStatus",
152
- "label",
153
- "orderAutomation",
154
- "post",
155
- ],
156
- },
157
- keyValue: {
158
- type: String,
159
- required: true,
160
- enum: [
161
- "senderEmail",
162
- "senderPhone",
163
- "emailSubject",
164
- "messageBody",
165
- "orderTrackingUrl",
166
- "withInBusinessHour",
167
- "afterBusinessHour",
168
- "allDay",
169
- "closeTicket",
170
- "openTicket",
171
- "publishedPosts",
172
- "label",
173
- "orderConfirmation",
174
- "orderPublish",
175
- ],
176
- },
177
- subKeyValue: {
178
- type: String,
179
- required: false,
180
- enum: ["trackingNo", "orderNumber", "both"],
181
- },
182
- },
183
- values: [
184
- {
185
- type: String,
186
- },
187
- ],
188
- contains: {
189
- type: String,
190
- enum: ["equalTo", "contains", "notEqualTo", "notContains"],
191
- },
192
- });
193
- const AutomationIntegration = new Schema({
194
- id: {
195
- type: Schema.Types.ObjectId,
196
- ref: "Integration",
197
- required: true,
198
- },
199
- contentType: defaultStringType,
200
- type: {
201
- type: String,
202
- required: true,
203
- },
204
- accountTitle: defaultStringType,
205
- _id: false,
206
- });
207
-
208
- const AutomationSchema = new Schema(
209
- {
210
- title: {
211
- type: String,
212
- required: true,
213
- },
214
- event: {
215
- type: String,
216
- enum: ["newConversation", "message", "ticket", "order"],
217
- default: "newConversation",
218
- required: true,
219
- },
220
- integratedPlatformId: [AutomationIntegration],
221
- workspaceId: defaultStringType,
222
- enabled: {
223
- type: Boolean,
224
- default: true,
225
- },
226
- conditionGroups: [
227
- {
228
- conditionalMatch: {
229
- type: String,
230
- enum: ["any", "all"],
231
- default: "any",
232
- },
233
- conditions: [AutomationCondition],
234
- actions: AutomationAction,
235
- },
236
- ],
237
- },
238
- { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
239
- );
240
-
241
- const Automation = mongoose.model("Automation", AutomationSchema);
242
- module.exports = { Automation };
@@ -1,16 +0,0 @@
1
- const mongoose = require("mongoose");
2
-
3
- const businessRuleSchema = new mongoose.Schema(
4
- {
5
- allocation: { type: Number, default: "" },
6
- threshold: { type: Number, default: "" },
7
- cities: { type: String, default: "" },
8
- shiftedShipper: { type: String, default: "" },
9
- businessShifted: { type: Number, default: "" },
10
- shipper: { type: String, default: "" },
11
- workspaceId: { type: mongoose.Types.ObjectId, default: "" },
12
- },
13
- { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
14
- );
15
-
16
- module.exports = mongoose.model("BusinessRule", businessRuleSchema);
@@ -1,13 +0,0 @@
1
- const mongoose = require("mongoose");
2
-
3
- const businessRuleHelperSchema = new mongoose.Schema(
4
- {
5
- ruleId: { type: mongoose.Types.ObjectId, default: "" },
6
- next: { type: String, default: "" },
7
- active: { type: Boolean, default: "" },
8
- frequency: { type: Number, default: "" },
9
- },
10
- { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
11
- );
12
-
13
- module.exports = mongoose.model("BusinessRuleHelper", businessRuleHelperSchema);
@@ -1,22 +0,0 @@
1
- const mongoose = require("mongoose");
2
-
3
- const CatalogueSchema = new mongoose.Schema(
4
- {
5
- name: { type: String, default: "" },
6
- workspaceId: { type: String, default: "" },
7
- isDeleted: { type: Boolean, default: false },
8
- isDefault: { type: Boolean, default: false },
9
- images: {
10
- type: [
11
- {
12
- url: { type: String, default: "" },
13
- name: { type: String, default: "" },
14
- },
15
- ],
16
- default: [],
17
- },
18
- },
19
- { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
20
- );
21
-
22
- module.exports = mongoose.model("Catalogue", CatalogueSchema);
@@ -1,129 +0,0 @@
1
- const mongoose = require("mongoose");
2
- const { Schema } = mongoose;
3
- const CategorySchema = new Schema(
4
- {
5
- image: { type: String, default: "" },
6
- publishedAt: { type: String, default: "" },
7
- name: { type: String, default: "" },
8
- description: { type: String, default: "" },
9
- workspaceId: {
10
- type: Schema.Types.ObjectId,
11
- ref: "Workspace",
12
- default: null,
13
- },
14
- oldId: { type: String, default: "" },
15
- webCategoryId: { type: Number, default: null },
16
- parentId: { type: Schema.Types.ObjectId, ref: "Category", default: null },
17
- createdBy: { type: Schema.Types.ObjectId, ref: "User", default: null },
18
- updatedBy: { type: Schema.Types.ObjectId, ref: "User", default: null },
19
- isDeleted: { type: Boolean, default: false },
20
- },
21
- { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
22
- );
23
-
24
- CategorySchema.virtual("productCategories", {
25
- ref: "ProductCategory",
26
- localField: "_id",
27
- foreignField: "categoryId",
28
- });
29
-
30
- const Category = mongoose.model("Category", CategorySchema);
31
-
32
- const createNewCategory = async (categoryData) => {
33
- try {
34
- return await Category.create(categoryData);
35
- } catch (error) {
36
- return null;
37
- }
38
- };
39
-
40
- const findCategoryById = async (categoryId) => {
41
- try {
42
- return await Category.findById(categoryId);
43
- } catch (error) {
44
- return null;
45
- }
46
- };
47
-
48
- const updateCategoryById = async (criteria, updateData, options) => {
49
- try {
50
- return await Category.findByIdAndUpdate(criteria, updateData, options);
51
- } catch (error) {
52
- return null;
53
- }
54
- };
55
-
56
- const deleteCategoryById = async (categoryId) => {
57
- try {
58
- return await Category.findByIdAndDelete(categoryId);
59
- } catch (error) {
60
- return null;
61
- }
62
- };
63
-
64
- const findCategory = async (criteria = {}) => {
65
- try {
66
- return await Category.findOne(criteria);
67
- } catch (error) {
68
- return null;
69
- }
70
- };
71
-
72
- const findCategories = async (criteria = {}) => {
73
- try {
74
- return await Category.find(criteria);
75
- } catch (error) {
76
- return [];
77
- }
78
- };
79
-
80
- const categoriesByAggregation = async (aggregate = []) => {
81
- try {
82
- let categories = await Category.aggregate(aggregate);
83
- return categories;
84
- } catch (err) {
85
- return [];
86
- }
87
- };
88
-
89
- const categoriesUpdateMany = async (criteria, updateData, options = {}) => {
90
- try {
91
- return await Category.updateMany(criteria, updateData, options);
92
- } catch (error) {
93
- return null;
94
- }
95
- };
96
-
97
- const findOneAndUpdateCategory = async (
98
- findQuery,
99
- updateData,
100
- options = {}
101
- ) => {
102
- try {
103
- return await Category.findOneAndUpdate(findQuery, updateData, options);
104
- } catch (error) {
105
- return null;
106
- }
107
- };
108
-
109
- const findCategoryByPopulate = async (criteria = {}, populate = "") => {
110
- try {
111
- return await Category.findOne(criteria).populate(populate);
112
- } catch (error) {
113
- return null;
114
- }
115
- };
116
-
117
- module.exports = {
118
- Category,
119
- createNewCategory,
120
- findCategoryById,
121
- updateCategoryById,
122
- deleteCategoryById,
123
- findCategory,
124
- findCategories,
125
- categoriesByAggregation,
126
- categoriesUpdateMany,
127
- findOneAndUpdateCategory,
128
- findCategoryByPopulate,
129
- };
@@ -1,21 +0,0 @@
1
- const { Schema, model } = require("mongoose");
2
-
3
- const ChatMemberSessionSchema = new Schema(
4
- {
5
- userId: {
6
- type: Schema.Types.ObjectId,
7
- ref: "ChatMember",
8
- default: null,
9
- },
10
- startTime: { type: String, default: "" },
11
- endTime: { type: String, default: "" },
12
- workspaceId: {
13
- type: Schema.Types.ObjectId,
14
- ref: "Workspace",
15
- default: null,
16
- },
17
- },
18
- { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
19
- );
20
-
21
- module.exports = model("ChatMemberSession", ChatMemberSessionSchema);
@@ -1,43 +0,0 @@
1
- const { Schema, model } = require("mongoose");
2
-
3
- const ChatMessageSchema = new Schema(
4
- {
5
- senderId: {
6
- type: Schema.Types.ObjectId,
7
- ref: "ChatMember",
8
- default: null,
9
- },
10
- receiverId: {
11
- type: Schema.Types.ObjectId,
12
- ref: "User",
13
- default: null,
14
- },
15
- message: { type: String, default: "" },
16
- attachment: { type: Array, default: [] },
17
- attachmentType: { type: String, default: "" },
18
- sessionId: {
19
- type: Schema.Types.ObjectId,
20
- ref: "ChatMemberSession",
21
- default: null,
22
- },
23
- workspaceId: {
24
- type: String,
25
- default: "",
26
- },
27
- type: {
28
- type: String,
29
- default: "",
30
- },
31
- complaintType: {
32
- type: String,
33
- default: "",
34
- },
35
- websiteName: {
36
- type: String,
37
- default: "",
38
- },
39
- },
40
- { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
41
- );
42
-
43
- module.exports = model("ChatMessage", ChatMessageSchema);
package/models/Color.js DELETED
@@ -1,10 +0,0 @@
1
- const mongoose = require("mongoose");
2
-
3
- const colorSchema = new mongoose.Schema(
4
- {
5
- name: { type: String, default: "" },
6
- },
7
- { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
8
- );
9
-
10
- module.exports = mongoose.model("Color", colorSchema);
@@ -1,21 +0,0 @@
1
- const { Schema, model } = require("mongoose");
2
-
3
- const CustomerCheckpointSchema = new Schema(
4
- {
5
- message: { type: String, default: "" },
6
- type: { type: String, default: "" },
7
- conversationPlatform: { type: String, default: null },
8
- customerId: { type: Schema.Types.ObjectId, default: null, ref: "Customer" },
9
- orderId: { type: Schema.Types.ObjectId, default: null, ref: "Order" },
10
- conversationId: { type: String, default: "" },
11
- workspaceId: {
12
- type: Schema.Types.ObjectId,
13
- ref: "Workspace",
14
- default: null,
15
- },
16
- latestTimeStamp: { type: String, default: "" },
17
- },
18
- { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
19
- );
20
-
21
- module.exports = model("CustomerCheckpoint", CustomerCheckpointSchema);
@@ -1,13 +0,0 @@
1
- const mongoose = require("mongoose");
2
- const { Schema } = mongoose;
3
-
4
- const DeviceInfoSchema = new Schema(
5
- {
6
- userId: String,
7
- token: String,
8
- device: String,
9
- },
10
- { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
11
- );
12
- const DeviceInfo = mongoose.model("DeviceInfo", DeviceInfoSchema);
13
- module.exports = DeviceInfo;
package/models/Email.js DELETED
@@ -1,21 +0,0 @@
1
- const mongoose = require("mongoose");
2
- const { Schema } = mongoose;
3
-
4
- const EmailSchema = new Schema(
5
- {
6
- name: { type: String, default: "" },
7
- address: { type: String, default: "" },
8
- contact: { type: String, default: "" },
9
- email: { type: String, default: "" },
10
- reference: { type: String, default: "" },
11
- city: { type: String, default: "" },
12
- isBlackListed: { type: Boolean, default: false },
13
- customerId: { type: String, default: "" },
14
- workspaceId: { type: String, default: "" },
15
- designation: { type: String, default: "" },
16
- },
17
- { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
18
- );
19
-
20
- const Email = mongoose.model("Email", EmailSchema);
21
- module.exports = Email;
@@ -1,30 +0,0 @@
1
- const mongoose = require("mongoose");
2
- const { Schema } = mongoose;
3
-
4
- const EmailMessageSchema = new Schema(
5
- {
6
- workspaceId: { type: String, default: "" },
7
- threadId: { type: String, default: "" },
8
- messageId: { type: String, default: "" },
9
- message: { type: String, default: "" },
10
- subject: { type: String, default: "" },
11
- trackingId: { type: String, default: "" },
12
- integratedEmail: { type: String, default: "" },
13
- receiverEmail: { type: String, default: "" },
14
- senderEmail: { type: String, default: "" },
15
- agentId: { type: String, default: "" },
16
- isRead: { type: Boolean, default: false },
17
- type: { type: String, default: "email" },
18
- attachmentArr: [
19
- {
20
- attachmentId: { type: String, default: "" },
21
- attachemntName: { type: String, default: "" },
22
- attachmentSize: { type: String, default: "" },
23
- },
24
- ],
25
- right: { type: Boolean, default: true },
26
- },
27
- { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
28
- );
29
-
30
- module.exports = EmailMessageSchema;
@@ -1,17 +0,0 @@
1
- const mongoose = require("mongoose");
2
-
3
- const emailNotificationSchema = new mongoose.Schema(
4
- {
5
- threadId: { type: String, default: "" },
6
- messageId: { type: String, default: "" },
7
- message: { type: String, default: "" },
8
- subject: { type: String, default: "" },
9
- trackingId: { type: String, default: "" },
10
- integratedEmail: { type: String, default: "" },
11
- receiverEmail: { type: String, default: "" },
12
- senderEmail: { type: String, default: "" },
13
- },
14
- { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
15
- );
16
-
17
- module.exports = mongoose.model("EmailNotification", emailNotificationSchema);