shuttlepro-shared 1.3.40 → 1.3.42

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 +83 -14
  2. package/common/repositories/userRole.repository.js +5 -2
  3. package/config/redis.js +72 -73
  4. package/middlewares/checkPermission/index.js +36 -23
  5. package/models/Activity.js +28 -0
  6. package/models/ActivityLogs.js +1 -0
  7. package/models/AgentActivity.js +5 -4
  8. package/models/Attribute.js +130 -0
  9. package/models/Automation.js +242 -0
  10. package/models/BusinessRule.js +16 -0
  11. package/models/BusinessRuleHelper.js +13 -0
  12. package/models/Card.js +50 -1
  13. package/models/Catalogue.js +22 -0
  14. package/models/Category.js +129 -0
  15. package/models/ChatMemberSession.js +21 -0
  16. package/models/ChatMessage.js +43 -0
  17. package/models/Chatbot.js +1 -1
  18. package/models/Color.js +10 -0
  19. package/models/Column.js +6 -0
  20. package/models/Conversation.js +40 -0
  21. package/models/Customer.js +2 -1
  22. package/models/CustomerCheckpoint.js +21 -0
  23. package/models/DeviceInfo.js +13 -0
  24. package/models/Email.js +21 -0
  25. package/models/EmailMessage.js +30 -0
  26. package/models/EmailNotification.js +17 -0
  27. package/models/EscalationConfiguration.js +123 -0
  28. package/models/EscalationManager.js +50 -0
  29. package/models/Faq.js +29 -0
  30. package/models/FeedbackResponse.js +72 -0
  31. package/models/FormTemplate.js +27 -0
  32. package/models/Integration.js +6 -0
  33. package/models/InternalComments.js +27 -0
  34. package/models/InternalThreads.js +20 -0
  35. package/models/JobDesign.js +32 -0
  36. package/models/JobQueue.js +17 -0
  37. package/models/LabelsPdf.js +12 -0
  38. package/models/Layout.js +12 -0
  39. package/models/LoadSheet.js +31 -0
  40. package/models/Location.js +148 -0
  41. package/models/Logo.js +11 -0
  42. package/models/MailGroup.js +21 -0
  43. package/models/Notification.js +32 -0
  44. package/models/Order.js +11 -0
  45. package/models/OrderPdf.js +29 -0
  46. package/models/PostsAutomation.js +66 -0
  47. package/models/Product.js +337 -0
  48. package/models/ProductAttachment.js +158 -0
  49. package/models/ProductAttribute.js +140 -0
  50. package/models/ProductCategory.js +128 -0
  51. package/models/ProductLabels.js +11 -0
  52. package/models/ProductShopify.js +13 -0
  53. package/models/ProductTag.js +124 -0
  54. package/models/ProductVariant.js +157 -0
  55. package/models/Profile.js +3 -1
  56. package/models/ServiceUsage.js +26 -0
  57. package/models/ShipperSetting.js +24 -0
  58. package/models/SocialGroup.js +127 -0
  59. package/models/SocialPost.js +40 -0
  60. package/models/SocialProfile.js +56 -0
  61. package/models/Story.js +86 -0
  62. package/models/Tag.js +77 -0
  63. package/models/Template.js +76 -0
  64. package/models/TemplateFrame.js +55 -0
  65. package/models/TemplateTag.js +10 -0
  66. package/models/UserGuide.js +21 -0
  67. package/models/UserSession.js +47 -0
  68. package/models/VariantLocation.js +145 -0
  69. package/models/WhatsappFlow.js +29 -0
  70. package/models/Workflow.js +34 -0
  71. package/models/Workspace.js +78 -4
  72. package/models.js +168 -49
  73. package/package.json +1 -1
@@ -0,0 +1,242 @@
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 };
@@ -0,0 +1,16 @@
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);
@@ -0,0 +1,13 @@
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);
package/models/Card.js CHANGED
@@ -91,7 +91,20 @@ const cardSchema = new mongoose.Schema(
91
91
  },
92
92
  fieldType: {
93
93
  type: String,
94
- enum: DYNAMIC_FIELD_TYPES,
94
+ enum: [
95
+ "text",
96
+ "autocomplete",
97
+ "radio",
98
+ "text area",
99
+ "number",
100
+ "date",
101
+ "time",
102
+ "email",
103
+ "range",
104
+ "url",
105
+ "colour",
106
+ "file",
107
+ ],
95
108
  },
96
109
  fieldValueId: {
97
110
  type: mongoose.Schema.Types.Mixed,
@@ -107,6 +120,42 @@ const cardSchema = new mongoose.Schema(
107
120
  },
108
121
  },
109
122
  ],
123
+ assignId: {
124
+ type: mongoose.Schema.Types.Mixed,
125
+ default: null,
126
+ },
127
+ mergedTickets: {
128
+ type: [
129
+ {
130
+ id: { type: String, required: false },
131
+ ticketId: { type: String, required: false },
132
+ },
133
+ ],
134
+ default: [],
135
+ },
136
+ mergedInto: {
137
+ type: {
138
+ id: { type: String, required: false, default: "" },
139
+ ticketId: { type: String, required: false, default: "" },
140
+ },
141
+ default: null,
142
+ },
143
+ customerName: {
144
+ type: String,
145
+ default: "",
146
+ },
147
+ customerEmail: {
148
+ type: String,
149
+ default: "",
150
+ },
151
+ phoneNo: {
152
+ type: String,
153
+ default: "",
154
+ },
155
+ body: {
156
+ type: mongoose.Schema.Types.Mixed,
157
+ default: {},
158
+ },
110
159
  },
111
160
  { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
112
161
  );
@@ -0,0 +1,22 @@
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);
@@ -0,0 +1,129 @@
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
+ };
@@ -0,0 +1,21 @@
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);
@@ -0,0 +1,43 @@
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/Chatbot.js CHANGED
@@ -17,4 +17,4 @@ const ChatbotSchema = new Schema(
17
17
  },
18
18
  { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
19
19
  );
20
- module.exports = model("Chatbot", ChatbotSchema);
20
+ module.exports = ChatbotSchema;
@@ -0,0 +1,10 @@
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);
package/models/Column.js CHANGED
@@ -14,6 +14,12 @@ const columnSchema = new mongoose.Schema(
14
14
  type: Boolean,
15
15
  default: false,
16
16
  },
17
+ type: {
18
+ type: String,
19
+ enum: ["open", "processing", "hold", "closed"],
20
+ required: true,
21
+ default: "open",
22
+ },
17
23
  workspaceId: { type: String, default: "" },
18
24
  },
19
25
  { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
@@ -10,6 +10,14 @@ const draftSchema = new mongoose.Schema({
10
10
  createdBy: { type: Schema.Types.ObjectId, ref: "User" },
11
11
  });
12
12
 
13
+ const activitySchema = new mongoose.Schema({
14
+ action: { type: String, default: null },
15
+ previousAssignee: { type: Schema.Types.ObjectId, ref: "User", default: null },
16
+ newAssignee: { type: Schema.Types.ObjectId, ref: "User", default: null },
17
+ timestamp: { type: Date, default: Date.now },
18
+ performedBy: { type: Schema.Types.ObjectId, ref: "User", default: null },
19
+ });
20
+
13
21
  const conversationSchema = new mongoose.Schema(
14
22
  {
15
23
  platformType: {
@@ -76,12 +84,44 @@ const conversationSchema = new mongoose.Schema(
76
84
  draft: [draftSchema],
77
85
  isWebchatTicket: { type: Boolean, default: false },
78
86
  webchatComplaintType: { type: String, default: null },
87
+ isWebchatAutoReply: { type: Boolean, default: false },
88
+
79
89
  isComposed: { type: Boolean, default: false },
90
+ userMessageTime: { type: String, default: "" },
80
91
  utilityMessage: [],
81
92
  orderId: [],
82
93
  isFetch: { type: Boolean, default: true },
94
+ isAwaitingFeedback: { type: Boolean, default: true },
95
+ activities: [activitySchema],
83
96
  },
84
97
  { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
85
98
  );
86
99
 
100
+ conversationSchema.index({ workspaceId: 1, isSpam: 1 });
101
+ conversationSchema.index({ workspaceId: 1, isSpam: 1, conversationStatus: 1 });
102
+ conversationSchema.index({
103
+ workspaceId: 1,
104
+ isSpam: 1,
105
+ platformId: 1,
106
+ });
107
+ conversationSchema.index({
108
+ workspaceId: 1,
109
+ isSpam: 1,
110
+ platformId: 1,
111
+ conversationStatus: 1,
112
+ });
113
+ conversationSchema.index({
114
+ workspaceId: 1,
115
+ isSpam: 1,
116
+ platformId: 1,
117
+ conversationType: 1,
118
+ });
119
+ conversationSchema.index({
120
+ workspaceId: 1,
121
+ isSpam: 1,
122
+ platformId: 1,
123
+ conversationType: 1,
124
+ conversationStatus: 1,
125
+ });
126
+
87
127
  module.exports = mongoose.model("Conversation", conversationSchema);
@@ -6,17 +6,18 @@ const CustomerSchema = new Schema(
6
6
  name: { type: String, default: "" },
7
7
  email: { type: String, default: "" },
8
8
  phone: { type: String, default: "" },
9
+ phone1: { type: String, default: "" },
9
10
  city: { type: String, default: "" },
10
11
  country: { type: String, default: "pk" },
11
12
  defaultAddress: { type: String, default: "" },
12
13
  currentShippingAddress: {},
13
14
  addresses: [],
15
+ webCustomerId: { type: String, default: "" },
14
16
  workspaceId: {
15
17
  type: Schema.Types.ObjectId,
16
18
  ref: "Workspace",
17
19
  default: null,
18
20
  },
19
- phone1: { type: String, default: "" },
20
21
  isBlackListed: { type: Boolean, default: false },
21
22
  createdBy: {
22
23
  type: Schema.Types.ObjectId,
@@ -0,0 +1,21 @@
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);
@@ -0,0 +1,13 @@
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;