shuttlepro-shared 1.3.41 → 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.
- package/common/repositories/customerProfile.repository.js +83 -14
- package/common/repositories/userRole.repository.js +5 -2
- package/config/redis.js +72 -73
- package/middlewares/checkPermission/index.js +36 -23
- package/models/Activity.js +28 -0
- package/models/ActivityLogs.js +1 -0
- package/models/AgentActivity.js +5 -4
- package/models/Attribute.js +130 -0
- package/models/Automation.js +242 -0
- package/models/BusinessRule.js +16 -0
- package/models/BusinessRuleHelper.js +13 -0
- package/models/Card.js +50 -1
- package/models/Catalogue.js +22 -0
- package/models/Category.js +129 -0
- package/models/ChatMemberSession.js +21 -0
- package/models/ChatMessage.js +43 -0
- package/models/Chatbot.js +1 -1
- package/models/Color.js +10 -0
- package/models/Column.js +6 -0
- package/models/Conversation.js +40 -0
- package/models/Customer.js +2 -1
- package/models/CustomerCheckpoint.js +21 -0
- package/models/DeviceInfo.js +13 -0
- package/models/Email.js +21 -0
- package/models/EmailMessage.js +30 -0
- package/models/EmailNotification.js +17 -0
- package/models/EscalationConfiguration.js +123 -0
- package/models/EscalationManager.js +50 -0
- package/models/Faq.js +29 -0
- package/models/FeedbackResponse.js +72 -0
- package/models/FormTemplate.js +27 -0
- package/models/Integration.js +6 -0
- package/models/InternalComments.js +27 -0
- package/models/InternalThreads.js +20 -0
- package/models/JobDesign.js +32 -0
- package/models/JobQueue.js +17 -0
- package/models/LabelsPdf.js +12 -0
- package/models/Layout.js +12 -0
- package/models/LoadSheet.js +31 -0
- package/models/Location.js +148 -0
- package/models/Logo.js +11 -0
- package/models/MailGroup.js +21 -0
- package/models/Notification.js +32 -0
- package/models/Order.js +11 -0
- package/models/OrderPdf.js +29 -0
- package/models/PostsAutomation.js +66 -0
- package/models/Product.js +337 -0
- package/models/ProductAttachment.js +158 -0
- package/models/ProductAttribute.js +140 -0
- package/models/ProductCategory.js +128 -0
- package/models/ProductLabels.js +11 -0
- package/models/ProductShopify.js +13 -0
- package/models/ProductTag.js +124 -0
- package/models/ProductVariant.js +157 -0
- package/models/Profile.js +3 -1
- package/models/ServiceUsage.js +26 -0
- package/models/ShipperSetting.js +24 -0
- package/models/SocialGroup.js +127 -0
- package/models/SocialPost.js +40 -0
- package/models/SocialProfile.js +56 -0
- package/models/Story.js +86 -0
- package/models/Tag.js +77 -0
- package/models/Template.js +76 -0
- package/models/TemplateFrame.js +55 -0
- package/models/TemplateTag.js +10 -0
- package/models/UserGuide.js +21 -0
- package/models/UserSession.js +47 -0
- package/models/VariantLocation.js +145 -0
- package/models/WhatsappFlow.js +29 -0
- package/models/Workflow.js +34 -0
- package/models/Workspace.js +78 -4
- package/models.js +168 -49
- package/package.json +1 -1
package/models/Email.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
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;
|
|
@@ -0,0 +1,30 @@
|
|
|
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;
|
|
@@ -0,0 +1,17 @@
|
|
|
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);
|
|
@@ -0,0 +1,123 @@
|
|
|
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 };
|
|
@@ -0,0 +1,50 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
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;
|
|
@@ -0,0 +1,72 @@
|
|
|
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);
|
|
@@ -0,0 +1,27 @@
|
|
|
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;
|
package/models/Integration.js
CHANGED
|
@@ -48,4 +48,10 @@ const IntegrationSchema = new mongoose.Schema(
|
|
|
48
48
|
{ timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
|
|
49
49
|
);
|
|
50
50
|
|
|
51
|
+
IntegrationSchema.virtual("conversations", {
|
|
52
|
+
ref: "Conversation",
|
|
53
|
+
localField: "_id",
|
|
54
|
+
foreignField: "platformId",
|
|
55
|
+
});
|
|
56
|
+
|
|
51
57
|
module.exports = mongoose.model("Integration", IntegrationSchema);
|
|
@@ -0,0 +1,27 @@
|
|
|
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;
|
|
@@ -0,0 +1,20 @@
|
|
|
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;
|
|
@@ -0,0 +1,32 @@
|
|
|
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);
|
|
@@ -0,0 +1,17 @@
|
|
|
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);
|
|
@@ -0,0 +1,12 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
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);
|
|
@@ -0,0 +1,31 @@
|
|
|
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);
|
|
@@ -0,0 +1,148 @@
|
|
|
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
|
+
bcLocationId: { type: String, default: "" },
|
|
26
|
+
createdBy: { type: Schema.Types.ObjectId, ref: "User", default: null },
|
|
27
|
+
updatedBy: { type: Schema.Types.ObjectId, ref: "User", default: null },
|
|
28
|
+
},
|
|
29
|
+
{ timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
LocationSchema.virtual("variantLocations", {
|
|
33
|
+
ref: "VariantLocation",
|
|
34
|
+
localField: "_id",
|
|
35
|
+
foreignField: "locationId",
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const Location = mongoose.model("Location", LocationSchema);
|
|
39
|
+
|
|
40
|
+
const createNewLocation = async (locationData) => {
|
|
41
|
+
try {
|
|
42
|
+
return await Location.create(locationData);
|
|
43
|
+
} catch (error) {
|
|
44
|
+
console.log(error);
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const findLocationById = async (locationId) => {
|
|
50
|
+
try {
|
|
51
|
+
return await Location.findById(locationId);
|
|
52
|
+
} catch (error) {
|
|
53
|
+
console.log(error);
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const updateLocationById = async (criteria, updateData, options) => {
|
|
59
|
+
try {
|
|
60
|
+
return await Location.findByIdAndUpdate(criteria, updateData, options);
|
|
61
|
+
} catch (error) {
|
|
62
|
+
console.log(error);
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
const updateLocation = async (criteria, updateData, options) => {
|
|
67
|
+
try {
|
|
68
|
+
return await Location.findOneAndUpdate(criteria, updateData, options);
|
|
69
|
+
} catch (error) {
|
|
70
|
+
console.log(error);
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const findAndUpdateLocation = async (criteria, data, options) => {
|
|
76
|
+
try {
|
|
77
|
+
return await Location.findOneAndUpdate(criteria, data, options);
|
|
78
|
+
} catch (error) {
|
|
79
|
+
console.log(error);
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
const deleteLocationById = async (locationId) => {
|
|
84
|
+
try {
|
|
85
|
+
return await Location.findByIdAndDelete(locationId);
|
|
86
|
+
} catch (error) {
|
|
87
|
+
console.log(error);
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const findLocation = async (criteria) => {
|
|
93
|
+
try {
|
|
94
|
+
return await Location.findOne(criteria);
|
|
95
|
+
} catch (error) {
|
|
96
|
+
console.log(error);
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
const findLocations = async (criteria) => {
|
|
102
|
+
try {
|
|
103
|
+
return await Location.find(criteria);
|
|
104
|
+
} catch (error) {
|
|
105
|
+
console.log(error);
|
|
106
|
+
return [];
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const locationsByAggregation = async (aggregate = []) => {
|
|
111
|
+
try {
|
|
112
|
+
let locations = await Location.aggregate(aggregate);
|
|
113
|
+
return locations;
|
|
114
|
+
} catch (err) {
|
|
115
|
+
return [];
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const locationsUpdateMany = async (criteria, updateData, options = {}) => {
|
|
120
|
+
try {
|
|
121
|
+
return await Location.updateMany(criteria, updateData, options);
|
|
122
|
+
} catch (error) {
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
const insertLocations = async (locations) => {
|
|
128
|
+
try {
|
|
129
|
+
return await Location.insertMany(locations);
|
|
130
|
+
} catch (err) {
|
|
131
|
+
return [];
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
module.exports = {
|
|
136
|
+
Location,
|
|
137
|
+
createNewLocation,
|
|
138
|
+
findLocationById,
|
|
139
|
+
updateLocationById,
|
|
140
|
+
updateLocation,
|
|
141
|
+
deleteLocationById,
|
|
142
|
+
findLocation,
|
|
143
|
+
findLocations,
|
|
144
|
+
locationsByAggregation,
|
|
145
|
+
locationsUpdateMany,
|
|
146
|
+
insertLocations,
|
|
147
|
+
findAndUpdateLocation,
|
|
148
|
+
};
|