shuttlepro-shared 1.1.80 → 1.1.82
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/constants/index.js +0 -15
- package/index.js +0 -8
- package/models/Role.js +29 -0
- package/models/UserPermission.js +5 -0
- package/models/UserRole.js +10 -3
- package/models.js +2 -46
- package/package.json +2 -13
- package/common/repositories/index.js +0 -4
- package/common/repositories/integration.repository.js +0 -168
- package/common/repositories/workspace.repository.js +0 -95
- package/config/bull.js +0 -78
- package/config/config.js +0 -14
- package/config/database.js +0 -7
- package/config/index.js +0 -13
- package/config/redis.js +0 -162
- package/config/socket.js +0 -172
- package/models/AgentActivity.js +0 -189
- package/models/Assignment.js +0 -23
- package/models/BusinessDistribution.js +0 -23
- package/models/Card.js +0 -144
- package/models/CardComments.js +0 -33
- package/models/Checkpoint.js +0 -50
- package/models/City.js +0 -17
- package/models/Column.js +0 -28
- package/models/Conversation.js +0 -84
- package/models/Customer.js +0 -35
- package/models/DescriptionTemplate.js +0 -22
- package/models/Integration.js +0 -53
- package/models/Label.js +0 -42
- package/models/Message.js +0 -47
- package/models/Order.js +0 -131
- package/models/OrderProduct.js +0 -37
- package/models/Profile.js +0 -127
- package/models/Report.js +0 -27
- package/models/Shipper.js +0 -52
- package/models/Status.js +0 -58
- package/models/StatusType.js +0 -10
- package/models/Type.js +0 -25
- package/models/Workspace.js +0 -190
- package/utils/decorator-factory.js +0 -264
- package/utils/logger.js +0 -41
package/models/CardComments.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
const mongoose = require("mongoose");
|
|
2
|
-
|
|
3
|
-
const cardCommentSchema = new mongoose.Schema(
|
|
4
|
-
{
|
|
5
|
-
cardId: {
|
|
6
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
7
|
-
ref: "Card",
|
|
8
|
-
required: true,
|
|
9
|
-
},
|
|
10
|
-
commentText: {
|
|
11
|
-
type: String,
|
|
12
|
-
required: true,
|
|
13
|
-
},
|
|
14
|
-
createdBy: {
|
|
15
|
-
type: Object,
|
|
16
|
-
required: true,
|
|
17
|
-
},
|
|
18
|
-
readers: {
|
|
19
|
-
type: [],
|
|
20
|
-
default: [],
|
|
21
|
-
},
|
|
22
|
-
deleted: {
|
|
23
|
-
type: Boolean,
|
|
24
|
-
default: false,
|
|
25
|
-
},
|
|
26
|
-
updatedDate: {
|
|
27
|
-
type: Date,
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
{ timestamps: true }
|
|
31
|
-
);
|
|
32
|
-
|
|
33
|
-
module.exports = mongoose.model("CardComment", cardCommentSchema);
|
package/models/Checkpoint.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
const { Schema, model } = require("mongoose");
|
|
2
|
-
const Order = require("./Order");
|
|
3
|
-
const CheckpointSchema = new Schema(
|
|
4
|
-
{
|
|
5
|
-
bookingDate: { type: String, default: "" },
|
|
6
|
-
shipperType: { type: String, default: "" },
|
|
7
|
-
statusTime: { type: String, default: "" },
|
|
8
|
-
orderId: { type: Schema.Types.ObjectId, default: null, ref: "Order" },
|
|
9
|
-
statusId: { type: Schema.Types.ObjectId, default: null, ref: "Status" },
|
|
10
|
-
statusValue: { type: String, default: "" },
|
|
11
|
-
description: { 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
|
-
const initialStatuses = {
|
|
22
|
-
POSTEX: "departed to postex. warehouse",
|
|
23
|
-
DAEWOO: "booking",
|
|
24
|
-
TRAX: "shipment - arrived at origin",
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
CheckpointSchema.post("save", async function (doc) {
|
|
28
|
-
try {
|
|
29
|
-
if (
|
|
30
|
-
doc?.shipperType &&
|
|
31
|
-
doc?.statusValue.toLowerCase() === initialStatuses[doc?.shipperType]
|
|
32
|
-
) {
|
|
33
|
-
let order = await Order.findOneAndUpdate(
|
|
34
|
-
{
|
|
35
|
-
_id: doc.orderId,
|
|
36
|
-
workspaceId: doc.workspaceId,
|
|
37
|
-
},
|
|
38
|
-
{ $set: { statusUpdatedAt: doc.bookingDate } },
|
|
39
|
-
{ new: true }
|
|
40
|
-
);
|
|
41
|
-
console.log(order, "initial status from shipper");
|
|
42
|
-
}
|
|
43
|
-
return { code: 200 };
|
|
44
|
-
} catch (err) {
|
|
45
|
-
console.log("err", err);
|
|
46
|
-
return { code: 400 };
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
module.exports = model("Checkpoint", CheckpointSchema);
|
package/models/City.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
const { Schema, model } = require("mongoose");
|
|
2
|
-
|
|
3
|
-
const CitySchema = new Schema(
|
|
4
|
-
{
|
|
5
|
-
cityName: { type: String, default: "" },
|
|
6
|
-
correctedCityName: { type: String, default: "" },
|
|
7
|
-
cityCode: { type: String, default: "" },
|
|
8
|
-
area: { type: String, default: "" },
|
|
9
|
-
shipperType: { type: String, default: "" },
|
|
10
|
-
webCityId: { type: String, default: "" },
|
|
11
|
-
hubId: { type: String, default: "" },
|
|
12
|
-
body: {},
|
|
13
|
-
},
|
|
14
|
-
{ timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
|
|
15
|
-
);
|
|
16
|
-
|
|
17
|
-
module.exports = model("City", CitySchema);
|
package/models/Column.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
const mongoose = require("mongoose");
|
|
2
|
-
|
|
3
|
-
const columnSchema = new mongoose.Schema(
|
|
4
|
-
{
|
|
5
|
-
title: {
|
|
6
|
-
type: String,
|
|
7
|
-
required: true,
|
|
8
|
-
},
|
|
9
|
-
position: {
|
|
10
|
-
type: Number,
|
|
11
|
-
required: true,
|
|
12
|
-
},
|
|
13
|
-
deleted: {
|
|
14
|
-
type: Boolean,
|
|
15
|
-
default: false,
|
|
16
|
-
},
|
|
17
|
-
workspaceId: { type: String, default: "" },
|
|
18
|
-
},
|
|
19
|
-
{ timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
columnSchema.virtual("cardList", {
|
|
23
|
-
ref: "Card",
|
|
24
|
-
localField: "_id", // Change to '_id' to match the column's '_id'
|
|
25
|
-
foreignField: "columnId",
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
module.exports = mongoose.model("Column", columnSchema);
|
package/models/Conversation.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
const mongoose = require("mongoose");
|
|
2
|
-
const { Schema } = mongoose;
|
|
3
|
-
|
|
4
|
-
const draftSchema = new mongoose.Schema({
|
|
5
|
-
_id: {
|
|
6
|
-
type: Schema.Types.ObjectId,
|
|
7
|
-
default: () => new mongoose.Types.ObjectId(),
|
|
8
|
-
},
|
|
9
|
-
messageBody: {},
|
|
10
|
-
createdBy: { type: Schema.Types.ObjectId, ref: "User" },
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
const conversationSchema = new mongoose.Schema(
|
|
14
|
-
{
|
|
15
|
-
platformType: {
|
|
16
|
-
type: String,
|
|
17
|
-
enum: [
|
|
18
|
-
"gmail",
|
|
19
|
-
"instagram",
|
|
20
|
-
"whatsapp",
|
|
21
|
-
"linkedin",
|
|
22
|
-
"facebook",
|
|
23
|
-
"tiktok",
|
|
24
|
-
"webChat",
|
|
25
|
-
"smtp_gmail",
|
|
26
|
-
],
|
|
27
|
-
required: true,
|
|
28
|
-
},
|
|
29
|
-
members: [{ type: Schema.Types.ObjectId, ref: "User" }],
|
|
30
|
-
conversationType: {
|
|
31
|
-
type: String,
|
|
32
|
-
enum: ["comment", "message", "email"],
|
|
33
|
-
required: true,
|
|
34
|
-
},
|
|
35
|
-
messageCount: { type: Number, default: 0 },
|
|
36
|
-
conversationStatus: {
|
|
37
|
-
type: String,
|
|
38
|
-
enum: ["assigned", "unassigned", "archived"],
|
|
39
|
-
required: true,
|
|
40
|
-
default: "unassigned",
|
|
41
|
-
},
|
|
42
|
-
assignId: { type: Schema.Types.ObjectId, ref: "User", default: null },
|
|
43
|
-
platformId: {
|
|
44
|
-
type: Schema.Types.ObjectId,
|
|
45
|
-
ref: "Integration",
|
|
46
|
-
default: null,
|
|
47
|
-
},
|
|
48
|
-
labels: [{ type: Schema.Types.ObjectId, ref: "Label" }],
|
|
49
|
-
title: { type: String },
|
|
50
|
-
platformTimestamp: { type: String, default: "" },
|
|
51
|
-
status: {
|
|
52
|
-
type: String,
|
|
53
|
-
enum: ["open", "processing", "hold", "closed"],
|
|
54
|
-
required: true,
|
|
55
|
-
default: "open",
|
|
56
|
-
},
|
|
57
|
-
isSpam: { type: Boolean, default: false },
|
|
58
|
-
threadId: { type: String, default: "" },
|
|
59
|
-
messageId: { type: String, default: "" },
|
|
60
|
-
profileId: { type: Schema.Types.ObjectId, ref: "Profile" },
|
|
61
|
-
conversationCloseTime: { type: String },
|
|
62
|
-
workspaceId: { type: Schema.Types.ObjectId, ref: "Workspace" },
|
|
63
|
-
postId: { type: String, default: "" },
|
|
64
|
-
postUrl: { type: String, default: "" },
|
|
65
|
-
sender: { type: String, default: "" },
|
|
66
|
-
reasonForClosing: {
|
|
67
|
-
reason: { type: String, default: "" },
|
|
68
|
-
closedBy: { type: Schema.Types.ObjectId, ref: "User", default: null },
|
|
69
|
-
},
|
|
70
|
-
integratedAccount: { type: String, default: "" },
|
|
71
|
-
isRead: { type: Boolean, default: false },
|
|
72
|
-
ticketId: { type: String, default: "" },
|
|
73
|
-
draft: [draftSchema],
|
|
74
|
-
isWebchatTicket: { type: Boolean, default: false },
|
|
75
|
-
webchatComplaintType: { type: String, default: null },
|
|
76
|
-
isComposed: { type: Boolean, default: false },
|
|
77
|
-
utilityMessage: [],
|
|
78
|
-
orderId: [],
|
|
79
|
-
isFetch: { type: Boolean, default: true },
|
|
80
|
-
},
|
|
81
|
-
{ timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
|
|
82
|
-
);
|
|
83
|
-
|
|
84
|
-
module.exports = mongoose.model("Conversation", conversationSchema);
|
package/models/Customer.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
const mongoose = require("mongoose");
|
|
2
|
-
const { Schema } = mongoose;
|
|
3
|
-
|
|
4
|
-
const CustomerSchema = new Schema(
|
|
5
|
-
{
|
|
6
|
-
name: { type: String, default: "" },
|
|
7
|
-
email: { type: String, default: "" },
|
|
8
|
-
phone: { type: String, default: "" },
|
|
9
|
-
city: { type: String, default: "" },
|
|
10
|
-
defaultAddress: { type: String, default: "" },
|
|
11
|
-
currentShippingAddress: {},
|
|
12
|
-
addresses: [],
|
|
13
|
-
workspaceId: {
|
|
14
|
-
type: Schema.Types.ObjectId,
|
|
15
|
-
ref: "Workspace",
|
|
16
|
-
default: null,
|
|
17
|
-
},
|
|
18
|
-
phone1: { type: String, default: "" },
|
|
19
|
-
isBlackListed: { type: Boolean, default: false },
|
|
20
|
-
createdBy: {
|
|
21
|
-
type: Schema.Types.ObjectId,
|
|
22
|
-
ref: "User",
|
|
23
|
-
},
|
|
24
|
-
updatedBy: {
|
|
25
|
-
type: Schema.Types.ObjectId,
|
|
26
|
-
ref: "User",
|
|
27
|
-
},
|
|
28
|
-
isDeleted: { type: Boolean, default: false },
|
|
29
|
-
},
|
|
30
|
-
{ timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
|
|
31
|
-
);
|
|
32
|
-
|
|
33
|
-
const Customer = mongoose.model("Customer", CustomerSchema);
|
|
34
|
-
|
|
35
|
-
module.exports = Customer;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
const mongoose = require("mongoose");
|
|
2
|
-
const { Schema } = mongoose;
|
|
3
|
-
const DescriptionTemplateSchema = new Schema(
|
|
4
|
-
{
|
|
5
|
-
name: { type: String, default: "" },
|
|
6
|
-
subject: { type: String, default: "" },
|
|
7
|
-
format: { type: String, default: "" },
|
|
8
|
-
workspaceId: { type: String, default: "" },
|
|
9
|
-
businessId: { type: String, default: "" },
|
|
10
|
-
integrationId: { type: String, default: "" },
|
|
11
|
-
type: { type: String, default: "" },
|
|
12
|
-
body: {},
|
|
13
|
-
arbitraryValues: {},
|
|
14
|
-
moduleType: { type: String, default: "" },
|
|
15
|
-
},
|
|
16
|
-
{ timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
|
|
17
|
-
);
|
|
18
|
-
const DescriptionTemplate =
|
|
19
|
-
mongoose.models.DescriptionTemplate ||
|
|
20
|
-
mongoose.model("DescriptionTemplate", DescriptionTemplateSchema);
|
|
21
|
-
|
|
22
|
-
module.exports = DescriptionTemplate;
|
package/models/Integration.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
const mongoose = require("mongoose");
|
|
2
|
-
const { Schema } = mongoose;
|
|
3
|
-
|
|
4
|
-
const IntegrationSchema = new mongoose.Schema(
|
|
5
|
-
{
|
|
6
|
-
workspaceId: {
|
|
7
|
-
type: Schema.Types.ObjectId,
|
|
8
|
-
ref: "Workspace",
|
|
9
|
-
default: null,
|
|
10
|
-
},
|
|
11
|
-
type: {
|
|
12
|
-
type: String,
|
|
13
|
-
enum: [
|
|
14
|
-
"socialPlatforms",
|
|
15
|
-
"whatsapp",
|
|
16
|
-
"gmail",
|
|
17
|
-
"sms",
|
|
18
|
-
"map",
|
|
19
|
-
"facebook",
|
|
20
|
-
"instagram",
|
|
21
|
-
"webChat",
|
|
22
|
-
"smtp_gmail",
|
|
23
|
-
],
|
|
24
|
-
},
|
|
25
|
-
chatbot: { type: Boolean, default: false },
|
|
26
|
-
isNlp: { type: Boolean, default: false },
|
|
27
|
-
autoTicket: {
|
|
28
|
-
enabled: { type: Boolean, default: false },
|
|
29
|
-
},
|
|
30
|
-
signature: {
|
|
31
|
-
type: Map,
|
|
32
|
-
of: mongoose.Schema.Types.Mixed,
|
|
33
|
-
default: {},
|
|
34
|
-
},
|
|
35
|
-
chatbotId: { type: Schema.Types.ObjectId, ref: "Chatbot", default: null },
|
|
36
|
-
members: [
|
|
37
|
-
{
|
|
38
|
-
type: Schema.Types.ObjectId,
|
|
39
|
-
ref: "User",
|
|
40
|
-
},
|
|
41
|
-
],
|
|
42
|
-
body: {},
|
|
43
|
-
},
|
|
44
|
-
{ timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
IntegrationSchema.virtual("conversations", {
|
|
48
|
-
ref: "Conversation",
|
|
49
|
-
localField: "_id",
|
|
50
|
-
foreignField: "platformId",
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
module.exports = mongoose.model("Integration", IntegrationSchema);
|
package/models/Label.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
const mongoose = require("mongoose");
|
|
2
|
-
const { Schema } = mongoose;
|
|
3
|
-
|
|
4
|
-
const LabelSchema = new Schema(
|
|
5
|
-
{
|
|
6
|
-
color: { type: String },
|
|
7
|
-
title: {
|
|
8
|
-
type: String,
|
|
9
|
-
required: true,
|
|
10
|
-
},
|
|
11
|
-
type: {
|
|
12
|
-
type: String,
|
|
13
|
-
required: true,
|
|
14
|
-
default: "system",
|
|
15
|
-
enum: ["system", "custom", "escalation"],
|
|
16
|
-
},
|
|
17
|
-
workspaceId: {
|
|
18
|
-
type: Schema.Types.ObjectId,
|
|
19
|
-
ref: "Workspace",
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
{ timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
|
|
23
|
-
);
|
|
24
|
-
LabelSchema.virtual("conversationCount", {
|
|
25
|
-
ref: "Conversation",
|
|
26
|
-
localField: "_id",
|
|
27
|
-
foreignField: "labels",
|
|
28
|
-
count: true,
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
LabelSchema.virtual("conversations", {
|
|
32
|
-
ref: "Conversation",
|
|
33
|
-
localField: "_id",
|
|
34
|
-
foreignField: "labels",
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
LabelSchema.set("toObject", { virtuals: true });
|
|
38
|
-
LabelSchema.set("toJSON", { virtuals: true });
|
|
39
|
-
|
|
40
|
-
const Label = mongoose.model("Label", LabelSchema);
|
|
41
|
-
|
|
42
|
-
module.exports = Label;
|
package/models/Message.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
const mongoose = require("mongoose");
|
|
2
|
-
const { Schema } = mongoose;
|
|
3
|
-
|
|
4
|
-
const readBySchema = new Schema({
|
|
5
|
-
receiptTrigger: { type: Boolean, default: false },
|
|
6
|
-
readerId: { type: Schema.Types.ObjectId, ref: "User", default: null },
|
|
7
|
-
readTime: { type: String, default: "" },
|
|
8
|
-
responseTime: { type: String, default: "" },
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
const newMessageSchema = new mongoose.Schema(
|
|
12
|
-
{
|
|
13
|
-
workspaceId: {
|
|
14
|
-
type: Schema.Types.ObjectId,
|
|
15
|
-
ref: "Workspace",
|
|
16
|
-
default: null,
|
|
17
|
-
},
|
|
18
|
-
readBy: [readBySchema],
|
|
19
|
-
messageType: {
|
|
20
|
-
type: String,
|
|
21
|
-
enum: [
|
|
22
|
-
"system",
|
|
23
|
-
"user",
|
|
24
|
-
"internal",
|
|
25
|
-
"chatbot",
|
|
26
|
-
"auto-generated",
|
|
27
|
-
"facebook",
|
|
28
|
-
"instagram",
|
|
29
|
-
"webChat",
|
|
30
|
-
"chat-status",
|
|
31
|
-
],
|
|
32
|
-
required: true,
|
|
33
|
-
},
|
|
34
|
-
conversationId: {
|
|
35
|
-
type: Schema.Types.ObjectId,
|
|
36
|
-
ref: "Conversation",
|
|
37
|
-
default: null,
|
|
38
|
-
},
|
|
39
|
-
conversationType: { type: String },
|
|
40
|
-
activityId: { type: String, default: "" },
|
|
41
|
-
|
|
42
|
-
body: {},
|
|
43
|
-
},
|
|
44
|
-
{ timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
module.exports = mongoose.model("Message", newMessageSchema);
|
package/models/Order.js
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
const mongoose = require("mongoose");
|
|
2
|
-
const { Schema } = mongoose;
|
|
3
|
-
|
|
4
|
-
const ShipperInformation = new Schema({
|
|
5
|
-
_id: false,
|
|
6
|
-
shipperType: { type: String, default: "" },
|
|
7
|
-
weight: { type: Number, default: 0 }, //M&P, TRAX, INSTA, RIDER, TCS, CC
|
|
8
|
-
fragile: { type: Boolean, default: false }, //M&P, TRAX, INSTA, RIDER, TCS, CC
|
|
9
|
-
serviceType: { type: String, default: "" }, //M&P, TRAX, INSTA, RIDER, TCS, CC
|
|
10
|
-
serviceTypeId: { type: String, default: 1 }, //M&P, TRAX, INSTA, RIDER, TCS, CC
|
|
11
|
-
pieces: { type: Number, default: 0 }, //M&P, TRAX, INSTA, RIDER, TCS, CC
|
|
12
|
-
originCityName: { type: String, default: "" }, //M&P, TRAX, INSTA, RIDER, TCS, CC
|
|
13
|
-
remarks: { type: String, default: "" },
|
|
14
|
-
customer_note: { type: String, default: "" },
|
|
15
|
-
return_branch: { type: String, default: "" },
|
|
16
|
-
cityData: { type: String, default: "" }, //M&P, TRAX, INSTA, RIDER, TCS, CC
|
|
17
|
-
//TRAX
|
|
18
|
-
paymentMode: { type: Number, default: 0 },
|
|
19
|
-
addressId: { type: Number, default: 0 },
|
|
20
|
-
itemProductType: { type: Number, default: 0 },
|
|
21
|
-
shippingMode: { type: Number, default: 0 },
|
|
22
|
-
itemInsurance: { type: Boolean, default: false },
|
|
23
|
-
informationDisplay: { type: String, default: "" },
|
|
24
|
-
//Call Courier (CC)
|
|
25
|
-
shipperName: { type: String, default: "" },
|
|
26
|
-
shipperEmail: { type: String, default: "" },
|
|
27
|
-
shipperCellNo: { type: String, default: "" },
|
|
28
|
-
shipperLandlineNo: { type: String, default: "" },
|
|
29
|
-
shipperAddress: { type: String, default: "" },
|
|
30
|
-
shipperCityId: { type: Number, default: 0 },
|
|
31
|
-
shipperAreaId: { type: Number, default: 0 },
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
const OrderSchema = new Schema(
|
|
35
|
-
{
|
|
36
|
-
customerId: { type: Schema.Types.ObjectId, ref: "Customer", default: null },
|
|
37
|
-
swap: { type: String, default: "" },
|
|
38
|
-
shipperInformation: ShipperInformation,
|
|
39
|
-
trackingId: { type: String, default: "" },
|
|
40
|
-
cityName: { type: String, default: "" },
|
|
41
|
-
status: { type: String, default: "" },
|
|
42
|
-
lastStatusTime: { type: String, default: "" },
|
|
43
|
-
statusType: { type: String, default: "" },
|
|
44
|
-
returnOrder: {
|
|
45
|
-
received: { type: Boolean, default: false },
|
|
46
|
-
restocked: { type: Boolean, default: false },
|
|
47
|
-
remarks: { type: String, default: "" },
|
|
48
|
-
},
|
|
49
|
-
statusTypeId: {
|
|
50
|
-
type: Schema.Types.ObjectId,
|
|
51
|
-
ref: "StatusType",
|
|
52
|
-
default: null,
|
|
53
|
-
},
|
|
54
|
-
statusId: {
|
|
55
|
-
type: Schema.Types.ObjectId,
|
|
56
|
-
ref: "Status",
|
|
57
|
-
default: null,
|
|
58
|
-
},
|
|
59
|
-
totalAmount: { type: Number, default: 0 },
|
|
60
|
-
payableAmount: { type: Number, default: 0 },
|
|
61
|
-
parcelValue: { type: Number, default: 0 },
|
|
62
|
-
payableAmount: { type: Number, default: 0 },
|
|
63
|
-
customerName: { type: String, default: "" },
|
|
64
|
-
customerPhone: { type: String, default: "" },
|
|
65
|
-
customerAddress: { type: String, default: "" },
|
|
66
|
-
discountPercentage: { type: Number, default: 0 },
|
|
67
|
-
discountValue: { type: Number, default: 0 },
|
|
68
|
-
productDetails: { type: String, default: "" },
|
|
69
|
-
webOrderId: { type: String, default: "" },
|
|
70
|
-
webOrderNumber: { type: String, default: "" },
|
|
71
|
-
fulfillmentStatus: { type: String, default: "" },
|
|
72
|
-
webFulfillmentId: { type: String, default: "" },
|
|
73
|
-
pinLocation: { type: String, default: "" },
|
|
74
|
-
deliveryCharges: { type: Number, default: 0 },
|
|
75
|
-
tax: { type: Number, default: 0 },
|
|
76
|
-
workspaceId: {
|
|
77
|
-
type: Schema.Types.ObjectId,
|
|
78
|
-
ref: "Workspace",
|
|
79
|
-
default: null,
|
|
80
|
-
},
|
|
81
|
-
orderType: { type: String, default: "" },
|
|
82
|
-
barCode: { type: String, default: "" },
|
|
83
|
-
quantity: { type: Number, default: 0 },
|
|
84
|
-
assignTo: { type: Schema.Types.ObjectId, ref: "User", default: null },
|
|
85
|
-
isLoadSheetGenerated: { type: Boolean, default: false },
|
|
86
|
-
orderNumber: { type: String, default: "" },
|
|
87
|
-
orderDate: { type: String, default: "" },
|
|
88
|
-
returnDate: { type: String, default: "" },
|
|
89
|
-
receivedDate: { type: String, default: "" },
|
|
90
|
-
published: { type: Boolean, default: false },
|
|
91
|
-
isFlagged: { type: Boolean, default: false },
|
|
92
|
-
publishedTime: { type: String, default: "" },
|
|
93
|
-
paymentType: { type: String, default: "COD" },
|
|
94
|
-
isDeleted: { type: Boolean, default: false },
|
|
95
|
-
isFake: { type: Boolean, default: false },
|
|
96
|
-
statusUpdatedAt: { type: String, default: "" },
|
|
97
|
-
invalidCity: { type: Boolean, default: false },
|
|
98
|
-
invalidCredentials: { type: Boolean, default: false },
|
|
99
|
-
isConfirmed: { type: Boolean, default: false },
|
|
100
|
-
confirmedBy: { type: Schema.Types.ObjectId, ref: "User", default: null },
|
|
101
|
-
isBulk: { type: String, default: "" },
|
|
102
|
-
priority: { type: String, default: "" },
|
|
103
|
-
conversationId: { type: String, default: "" },
|
|
104
|
-
createdBy: { type: Schema.Types.ObjectId, ref: "User", default: null },
|
|
105
|
-
updatedBy: { type: Schema.Types.ObjectId, ref: "User", default: null },
|
|
106
|
-
publishedStatus: { type: String, default: "pending" },
|
|
107
|
-
isDuplicate: { type: Boolean, default: false },
|
|
108
|
-
ivrGenerated: { type: Boolean, default: false },
|
|
109
|
-
isActivityGenerated: { type: Boolean, default: false },
|
|
110
|
-
platformFinancialStatus: { type: String, default: "pending" },
|
|
111
|
-
payment: {},
|
|
112
|
-
credentials: {},
|
|
113
|
-
},
|
|
114
|
-
{ timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
|
|
115
|
-
);
|
|
116
|
-
|
|
117
|
-
OrderSchema.virtual("checkPoints", {
|
|
118
|
-
ref: "Checkpoint",
|
|
119
|
-
localField: "_id",
|
|
120
|
-
foreignField: "orderId",
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
OrderSchema.virtual("orderProducts", {
|
|
124
|
-
ref: "OrderProduct",
|
|
125
|
-
localField: "_id",
|
|
126
|
-
foreignField: "orderId",
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
const Order = mongoose.model("Order", OrderSchema);
|
|
130
|
-
|
|
131
|
-
module.exports = Order;
|
package/models/OrderProduct.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
const { Schema, model } = require("mongoose");
|
|
2
|
-
const OrderProductSchema = new Schema(
|
|
3
|
-
{
|
|
4
|
-
orderId: { type: Schema.Types.ObjectId, ref: "Order", default: null },
|
|
5
|
-
productId: { type: Schema.Types.ObjectId, ref: "Product", default: null },
|
|
6
|
-
variantId: {
|
|
7
|
-
type: Schema.Types.ObjectId,
|
|
8
|
-
ref: "ProductVariant",
|
|
9
|
-
default: null,
|
|
10
|
-
},
|
|
11
|
-
locationId: {
|
|
12
|
-
type: Schema.Types.ObjectId,
|
|
13
|
-
ref: "Location",
|
|
14
|
-
default: null,
|
|
15
|
-
},
|
|
16
|
-
quantity: { type: Number, default: 0 },
|
|
17
|
-
price: { type: Number, default: 0 },
|
|
18
|
-
totalAmount: { type: Number, default: 0 },
|
|
19
|
-
discountPercentage: { type: Number, default: 0 },
|
|
20
|
-
webFulfillmentOrderId: { type: String, default: "" },
|
|
21
|
-
webFulfillmentId: { type: String, default: "" },
|
|
22
|
-
isFullfilled: { type: Boolean, default: false },
|
|
23
|
-
isDeleted: { type: Boolean, default: false },
|
|
24
|
-
discountValue: { type: Number, default: 0 },
|
|
25
|
-
webLineItemId: { type: String, default: "" },
|
|
26
|
-
status: { type: String, default: "open" },
|
|
27
|
-
hyperLink: { type: String, default: "" },
|
|
28
|
-
parentOrderProductId: { type: Schema.Types.ObjectId, default: null },
|
|
29
|
-
workspaceId: {
|
|
30
|
-
type: Schema.Types.ObjectId,
|
|
31
|
-
ref: "Workspace",
|
|
32
|
-
default: null,
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
{ timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
|
|
36
|
-
);
|
|
37
|
-
module.exports = model("OrderProduct", OrderProductSchema);
|