shuttlepro-shared 1.3.13 → 1.3.14
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/UserRole.js +119 -1
- package/models/Website.js +1 -0
- package/models.js +1 -62
- package/package.json +2 -13
- package/common/repositories/chatMember.repository.js +0 -9
- package/common/repositories/customerProfile.repository.js +0 -147
- package/common/repositories/descriptionTemplates.repository.js +0 -229
- package/common/repositories/index.js +0 -32
- package/common/repositories/integration.repository.js +0 -210
- package/common/repositories/label.repository.js +0 -95
- package/common/repositories/notificationSettings.repository.js +0 -95
- package/common/repositories/role.repository.js +0 -333
- package/common/repositories/settings.repository.js +0 -32
- package/common/repositories/shipper.repository.js +0 -77
- package/common/repositories/socialMediaSetting.repository.js +0 -33
- package/common/repositories/user.repository.js +0 -150
- package/common/repositories/userPermission.repository.js +0 -228
- package/common/repositories/userRepository.js +0 -31
- package/common/repositories/userRole.repository.js +0 -235
- package/common/repositories/userRolePermission.repository.js +0 -59
- package/common/repositories/workspace.repository.js +0 -147
- package/config/bull.js +0 -78
- package/config/config.js +0 -14
- package/config/database.js +0 -4
- package/config/index.js +0 -13
- package/config/redis.js +0 -196
- package/config/socket.js +0 -172
- package/models/AgentActivity.js +0 -192
- 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/ChatMember.js +0 -17
- package/models/Chatbot.js +0 -20
- package/models/Checkpoint.js +0 -50
- package/models/City.js +0 -17
- package/models/Column.js +0 -28
- package/models/Conversation.js +0 -87
- package/models/Customer.js +0 -36
- package/models/CustomerProfile.js +0 -27
- package/models/DefaultRolePermission.js +0 -34
- package/models/DescriptionTemplate.js +0 -22
- package/models/Integration.js +0 -51
- package/models/Label.js +0 -42
- package/models/Message.js +0 -47
- package/models/NewProduct.js +0 -71
- package/models/NotificationSettings.js +0 -130
- package/models/Order.js +0 -236
- package/models/OrderProduct.js +0 -37
- package/models/Profile.js +0 -127
- package/models/Report.js +0 -27
- package/models/Setting.js +0 -18
- package/models/Shipper.js +0 -62
- package/models/SocialMediaSetting.js +0 -28
- package/models/Status.js +0 -58
- package/models/StatusType.js +0 -10
- package/models/Step.js +0 -50
- package/models/Type.js +0 -25
- package/models/UserWorkflow.js +0 -46
- package/models/Workspace.js +0 -308
- package/utils/decorator-factory.js +0 -264
- package/utils/logger.js +0 -41
package/models/Shipper.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
const mongoose = require("mongoose");
|
|
2
|
-
const { Schema } = mongoose;
|
|
3
|
-
|
|
4
|
-
const shipperInformationSchema = new Schema({
|
|
5
|
-
weight: { type: Number, default: 0 }, //M&P, TRAX, INSTA, RIDER, TCS, CC
|
|
6
|
-
fragile: { type: Boolean, default: false }, //M&P, TRAX, INSTA, RIDER, TCS, CC
|
|
7
|
-
serviceType: { type: String, default: "" }, //M&P, TRAX, INSTA, RIDER, TCS, CC
|
|
8
|
-
serviceTypeId: { type: String, default: "" }, //M&P, TRAX, INSTA, RIDER, TCS, CC
|
|
9
|
-
pieces: { type: Number, default: 0 }, //M&P, TRAX, INSTA, RIDER, TCS, CC
|
|
10
|
-
originCityName: { type: String, default: "" }, //M&P, TRAX, INSTA, RIDER, TCS, CC
|
|
11
|
-
costCenterCode: { type: String, default: "" }, //M&P, TRAX, INSTA, RIDER, TCS, CC
|
|
12
|
-
remarks: { type: String, default: "" },
|
|
13
|
-
customer_note: { type: String, default: "" },
|
|
14
|
-
cityData: { type: String, default: "" },
|
|
15
|
-
return_branch: { type: String, default: "" },
|
|
16
|
-
//M&P, TRAX, INSTA, RIDER, TCS, CC
|
|
17
|
-
//TRAX
|
|
18
|
-
paymentMode: { type: Number, default: 0 },
|
|
19
|
-
addressId: { type: Number, default: 0 }, //this will not be shown
|
|
20
|
-
itemProductType: { type: Number, default: 0 },
|
|
21
|
-
shippingMode: { type: Number, default: 0 },
|
|
22
|
-
itemInsurance: { type: Boolean, default: false }, //this will not be shown
|
|
23
|
-
informationDisplay: { type: String, default: "" },
|
|
24
|
-
//Call Courier (CC)
|
|
25
|
-
shipperId: { type: Number, default: 0 }, //this will not be showm
|
|
26
|
-
shipperName: { type: String, default: "" }, //this will not be shown
|
|
27
|
-
shipperEmail: { type: String, default: "" }, //this will not be shown
|
|
28
|
-
shipperCellNo: { type: String, default: "" }, //this will not be shown
|
|
29
|
-
shipperLandlineNo: { type: String, default: "" }, //this will not be shown
|
|
30
|
-
shipperAddress: { type: String, default: "" }, //this will not be shown
|
|
31
|
-
shipperCityId: { type: Number, default: 0 }, //this will not be shown
|
|
32
|
-
shipperAreaId: { type: Number, default: 0 }, //this will not be shown
|
|
33
|
-
locationId: { type: Number, default: 0 }, //this will not be shown
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
const shipperSchema = new mongoose.Schema(
|
|
37
|
-
{
|
|
38
|
-
type: { type: String, default: "" },
|
|
39
|
-
userName: { type: String, default: "" },
|
|
40
|
-
password: { type: String, default: "" },
|
|
41
|
-
clientId: { type: String, default: "" },
|
|
42
|
-
clientSecret: { type: String, default: "" },
|
|
43
|
-
bearerToken: { type: String, default: "" },
|
|
44
|
-
accessToken: { type: String, default: "" },
|
|
45
|
-
accountNo: { type: String, default: "" },
|
|
46
|
-
businessName: { type: String, default: "" },
|
|
47
|
-
businessPhone: { type: String, default: "" },
|
|
48
|
-
businessAddress: { type: String, default: "" },
|
|
49
|
-
workspaceId: {
|
|
50
|
-
type: Schema.Types.ObjectId,
|
|
51
|
-
ref: "Workspace",
|
|
52
|
-
default: null,
|
|
53
|
-
},
|
|
54
|
-
shipperInformation: shipperInformationSchema,
|
|
55
|
-
isDeleted: { type: Boolean, default: false },
|
|
56
|
-
createdBy: { type: Schema.Types.ObjectId, ref: "User", default: null },
|
|
57
|
-
updatedBy: { type: Schema.Types.ObjectId, ref: "User", default: null },
|
|
58
|
-
},
|
|
59
|
-
{ timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
module.exports = mongoose.model("shipper", shipperSchema);
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
const { Schema, model } = require("mongoose");
|
|
2
|
-
const SocialMediaSettingSchema = new Schema(
|
|
3
|
-
{
|
|
4
|
-
workspaceId: {
|
|
5
|
-
type: Schema.Types.ObjectId,
|
|
6
|
-
ref: "Workspace",
|
|
7
|
-
default: null,
|
|
8
|
-
},
|
|
9
|
-
approvers: [
|
|
10
|
-
{
|
|
11
|
-
type: Schema.Types.ObjectId,
|
|
12
|
-
ref: "User",
|
|
13
|
-
default: null,
|
|
14
|
-
},
|
|
15
|
-
],
|
|
16
|
-
publishers: [
|
|
17
|
-
{
|
|
18
|
-
type: Schema.Types.ObjectId,
|
|
19
|
-
ref: "User",
|
|
20
|
-
default: null,
|
|
21
|
-
},
|
|
22
|
-
],
|
|
23
|
-
defaultApprove: { type: Boolean, default: true },
|
|
24
|
-
defaultPublish: { type: Boolean, default: true },
|
|
25
|
-
},
|
|
26
|
-
{ timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
|
|
27
|
-
);
|
|
28
|
-
module.exports = model("SocialMediaSetting", SocialMediaSettingSchema);
|
package/models/Status.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
const { Schema, model } = require("mongoose");
|
|
2
|
-
const { setRedisData, getRedisData } = require("../config/redis");
|
|
3
|
-
|
|
4
|
-
const StatusSchema = new Schema(
|
|
5
|
-
{
|
|
6
|
-
value: { type: String, default: "" },
|
|
7
|
-
description: { type: String, default: "" },
|
|
8
|
-
severity: { type: String, default: "1" },
|
|
9
|
-
shipperType: { type: String, default: "" },
|
|
10
|
-
internalValue: { type: String, default: "" },
|
|
11
|
-
statusTypeId: { type: Schema.Types.ObjectId, ref: "StatusType" },
|
|
12
|
-
type: { type: String, default: "" },
|
|
13
|
-
},
|
|
14
|
-
{ timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
|
|
15
|
-
);
|
|
16
|
-
|
|
17
|
-
StatusSchema.post("save", async function (doc) {
|
|
18
|
-
try {
|
|
19
|
-
addOrUpdateStatusInCache(doc);
|
|
20
|
-
} catch (err) {
|
|
21
|
-
console.log("err", err);
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
StatusSchema.post("findOneAndUpdate", async function (doc) {
|
|
26
|
-
try {
|
|
27
|
-
addOrUpdateStatusInCache(doc);
|
|
28
|
-
} catch (err) {
|
|
29
|
-
console.log("err", err);
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
const addOrUpdateStatusInCache = async (doc) => {
|
|
34
|
-
try {
|
|
35
|
-
const docId = doc?._id.toString();
|
|
36
|
-
let statuses = (await getRedisData("statuses")) || [];
|
|
37
|
-
if (!statuses || statuses.length === 0) {
|
|
38
|
-
// Fetch all statuses from the database if not found in Redis
|
|
39
|
-
const allStatuses = await model("Status").find().lean().exec();
|
|
40
|
-
statuses = allStatuses;
|
|
41
|
-
await setRedisData("statuses", statuses);
|
|
42
|
-
} else {
|
|
43
|
-
const statusesMap = statuses.reduce((map, status) => {
|
|
44
|
-
map[status._id.toString()] = status;
|
|
45
|
-
return map;
|
|
46
|
-
}, {});
|
|
47
|
-
statusesMap[docId] = doc.toObject();
|
|
48
|
-
statuses = Object.values(statusesMap);
|
|
49
|
-
await setRedisData("statuses", statuses);
|
|
50
|
-
}
|
|
51
|
-
return { code: 200 };
|
|
52
|
-
} catch (err) {
|
|
53
|
-
console.log("Error in addOrUpdateOrderInCache:", err);
|
|
54
|
-
return { code: 400 };
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
module.exports = model("Status", StatusSchema);
|
package/models/StatusType.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
const { Schema, model } = require("mongoose");
|
|
2
|
-
|
|
3
|
-
const StatusTypeSchema = new Schema(
|
|
4
|
-
{
|
|
5
|
-
name: { type: String, default: "" },
|
|
6
|
-
},
|
|
7
|
-
{ timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
|
|
8
|
-
);
|
|
9
|
-
|
|
10
|
-
module.exports = model("StatusType", StatusTypeSchema);
|
package/models/Step.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
const { Schema, model } = require("mongoose");
|
|
2
|
-
const StepSchema = new Schema(
|
|
3
|
-
{
|
|
4
|
-
placeholder: {
|
|
5
|
-
type: String,
|
|
6
|
-
default: "",
|
|
7
|
-
},
|
|
8
|
-
input: {
|
|
9
|
-
isRequire: {
|
|
10
|
-
type: Boolean,
|
|
11
|
-
default: false,
|
|
12
|
-
},
|
|
13
|
-
hint: {
|
|
14
|
-
type: String,
|
|
15
|
-
default: "",
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
apiCall: {
|
|
19
|
-
type: String,
|
|
20
|
-
default: "",
|
|
21
|
-
},
|
|
22
|
-
templateId: {
|
|
23
|
-
type: Schema.Types.ObjectId,
|
|
24
|
-
ref: "DescriptionTemplate",
|
|
25
|
-
default: null,
|
|
26
|
-
},
|
|
27
|
-
// module: {
|
|
28
|
-
// type: String,
|
|
29
|
-
// enum: ["product", "order", "customer", "general"],
|
|
30
|
-
// default: "general",
|
|
31
|
-
// },
|
|
32
|
-
parentId: {
|
|
33
|
-
type: Schema.Types.ObjectId,
|
|
34
|
-
ref: "Step",
|
|
35
|
-
default: null,
|
|
36
|
-
},
|
|
37
|
-
sortNumber: {
|
|
38
|
-
type: Number,
|
|
39
|
-
default: 0,
|
|
40
|
-
},
|
|
41
|
-
workspaceId: {
|
|
42
|
-
type: Schema.Types.ObjectId,
|
|
43
|
-
ref: "Workspace",
|
|
44
|
-
default: null,
|
|
45
|
-
},
|
|
46
|
-
chatbotId: { type: Schema.Types.ObjectId, ref: "Chatbot", default: null },
|
|
47
|
-
},
|
|
48
|
-
{ timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
|
|
49
|
-
);
|
|
50
|
-
module.exports = model("Step", StepSchema);
|
package/models/Type.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
const mongoose = require("mongoose");
|
|
2
|
-
|
|
3
|
-
const typeSchema = new mongoose.Schema(
|
|
4
|
-
{
|
|
5
|
-
title: {
|
|
6
|
-
type: String,
|
|
7
|
-
required: true,
|
|
8
|
-
},
|
|
9
|
-
deleted: {
|
|
10
|
-
type: Boolean,
|
|
11
|
-
default: false,
|
|
12
|
-
},
|
|
13
|
-
workspaceId: { type: String, default: "" },
|
|
14
|
-
color: { type: String, default: "#4a90e2", required: true },
|
|
15
|
-
},
|
|
16
|
-
{ timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
|
|
17
|
-
);
|
|
18
|
-
|
|
19
|
-
typeSchema.virtual("cardList", {
|
|
20
|
-
ref: "Card",
|
|
21
|
-
localField: "_id",
|
|
22
|
-
foreignField: "typeId",
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
module.exports = mongoose.model("Type", typeSchema);
|
package/models/UserWorkflow.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
const mongoose = require("mongoose");
|
|
2
|
-
const { Schema } = mongoose;
|
|
3
|
-
|
|
4
|
-
const userWorkflow = new Schema(
|
|
5
|
-
{
|
|
6
|
-
workspaceId: {
|
|
7
|
-
type: Schema.Types.ObjectId,
|
|
8
|
-
default: null,
|
|
9
|
-
ref: "Workspace",
|
|
10
|
-
},
|
|
11
|
-
workflow: {},
|
|
12
|
-
receiverId: {
|
|
13
|
-
type: String,
|
|
14
|
-
default: "",
|
|
15
|
-
},
|
|
16
|
-
whatsappTemplateData: {},
|
|
17
|
-
whatsappTemplate: {},
|
|
18
|
-
targetPayload: {},
|
|
19
|
-
business: {},
|
|
20
|
-
sender: {},
|
|
21
|
-
currentRetry: {
|
|
22
|
-
type: Number,
|
|
23
|
-
default: 0,
|
|
24
|
-
},
|
|
25
|
-
currentAction: {
|
|
26
|
-
type: String,
|
|
27
|
-
default: "",
|
|
28
|
-
},
|
|
29
|
-
lastMessage: {
|
|
30
|
-
type: String,
|
|
31
|
-
default: "",
|
|
32
|
-
},
|
|
33
|
-
status: {
|
|
34
|
-
type: String,
|
|
35
|
-
default: "pending",
|
|
36
|
-
},
|
|
37
|
-
otherTypeEvent: {
|
|
38
|
-
type: Boolean,
|
|
39
|
-
default: false,
|
|
40
|
-
},
|
|
41
|
-
allActions: [],
|
|
42
|
-
},
|
|
43
|
-
{ timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
module.exports = mongoose.model("UserWorkflow", userWorkflow);
|
package/models/Workspace.js
DELETED
|
@@ -1,308 +0,0 @@
|
|
|
1
|
-
const mongoose = require("mongoose");
|
|
2
|
-
//TODO: task manager and default location creation
|
|
3
|
-
const shiftSchema = new mongoose.Schema(
|
|
4
|
-
{
|
|
5
|
-
shiftName: {
|
|
6
|
-
type: String,
|
|
7
|
-
required: true,
|
|
8
|
-
},
|
|
9
|
-
days: [
|
|
10
|
-
{
|
|
11
|
-
day: { type: String, required: true },
|
|
12
|
-
startTime: { type: String, required: true },
|
|
13
|
-
endTime: { type: String, required: true },
|
|
14
|
-
breakStartTime: { type: String, required: false },
|
|
15
|
-
breakEndTime: { type: String, required: false },
|
|
16
|
-
lateThreshold: { type: String, required: false },
|
|
17
|
-
},
|
|
18
|
-
],
|
|
19
|
-
},
|
|
20
|
-
{ _id: true }
|
|
21
|
-
);
|
|
22
|
-
const scoreThresholdSchema = new mongoose.Schema({
|
|
23
|
-
operator: {
|
|
24
|
-
type: mongoose.Schema.Types.Mixed,
|
|
25
|
-
required: false,
|
|
26
|
-
},
|
|
27
|
-
value: {
|
|
28
|
-
type: mongoose.Schema.Types.Mixed,
|
|
29
|
-
required: true,
|
|
30
|
-
},
|
|
31
|
-
score: {
|
|
32
|
-
type: Number,
|
|
33
|
-
required: false,
|
|
34
|
-
},
|
|
35
|
-
additionalFields: {
|
|
36
|
-
type: mongoose.Schema.Types.Mixed,
|
|
37
|
-
default: {},
|
|
38
|
-
},
|
|
39
|
-
});
|
|
40
|
-
const kpiSchema = new mongoose.Schema({
|
|
41
|
-
weight: {
|
|
42
|
-
type: Number,
|
|
43
|
-
required: true,
|
|
44
|
-
},
|
|
45
|
-
scoreThresholds: {
|
|
46
|
-
type: [scoreThresholdSchema],
|
|
47
|
-
default: [],
|
|
48
|
-
},
|
|
49
|
-
relativeGrading: {
|
|
50
|
-
type: Boolean,
|
|
51
|
-
default: false,
|
|
52
|
-
},
|
|
53
|
-
});
|
|
54
|
-
const ReasonSchema = new mongoose.Schema({
|
|
55
|
-
_id: {
|
|
56
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
57
|
-
default: null,
|
|
58
|
-
},
|
|
59
|
-
reason: { type: String, required: true },
|
|
60
|
-
color: { type: String, default: "#000000" },
|
|
61
|
-
categoryTitle: { type: String, required: true },
|
|
62
|
-
});
|
|
63
|
-
const ResolutionReasonCategorySchema = new mongoose.Schema({
|
|
64
|
-
_id: {
|
|
65
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
66
|
-
default: null,
|
|
67
|
-
},
|
|
68
|
-
title: { type: String, required: true },
|
|
69
|
-
reasons: { type: [ReasonSchema], default: [] },
|
|
70
|
-
});
|
|
71
|
-
const feedbackFormSchema = new mongoose.Schema({
|
|
72
|
-
formName: { type: String, required: true, trim: true },
|
|
73
|
-
brandName: { type: String, default: "" },
|
|
74
|
-
brandLogoUrl: { type: String, default: "", trim: true },
|
|
75
|
-
type: {
|
|
76
|
-
type: String,
|
|
77
|
-
default: "conversation",
|
|
78
|
-
enum: [
|
|
79
|
-
"conversation",
|
|
80
|
-
"shop",
|
|
81
|
-
// "order"
|
|
82
|
-
],
|
|
83
|
-
},
|
|
84
|
-
qr: [
|
|
85
|
-
{
|
|
86
|
-
type: mongoose.Schema.Types.Mixed,
|
|
87
|
-
default: {
|
|
88
|
-
data: "",
|
|
89
|
-
code: "",
|
|
90
|
-
link: "",
|
|
91
|
-
shopId: "",
|
|
92
|
-
},
|
|
93
|
-
},
|
|
94
|
-
],
|
|
95
|
-
integrationId: [
|
|
96
|
-
{
|
|
97
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
98
|
-
ref: "Integration",
|
|
99
|
-
default: null,
|
|
100
|
-
},
|
|
101
|
-
],
|
|
102
|
-
enabled: {
|
|
103
|
-
type: Boolean,
|
|
104
|
-
default: true,
|
|
105
|
-
},
|
|
106
|
-
fields: [
|
|
107
|
-
{
|
|
108
|
-
fieldName: {
|
|
109
|
-
type: String,
|
|
110
|
-
required: true,
|
|
111
|
-
trim: true,
|
|
112
|
-
},
|
|
113
|
-
required: {
|
|
114
|
-
type: Boolean,
|
|
115
|
-
default: false,
|
|
116
|
-
},
|
|
117
|
-
enabled: {
|
|
118
|
-
type: Boolean,
|
|
119
|
-
default: true,
|
|
120
|
-
},
|
|
121
|
-
createdBy: {
|
|
122
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
123
|
-
ref: "User",
|
|
124
|
-
default: null,
|
|
125
|
-
},
|
|
126
|
-
updatedBy: {
|
|
127
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
128
|
-
ref: "User",
|
|
129
|
-
default: null,
|
|
130
|
-
},
|
|
131
|
-
fieldType: {
|
|
132
|
-
type: String,
|
|
133
|
-
enum: [
|
|
134
|
-
"text",
|
|
135
|
-
"autocomplete",
|
|
136
|
-
"radio",
|
|
137
|
-
"text area",
|
|
138
|
-
"number",
|
|
139
|
-
"date",
|
|
140
|
-
"time",
|
|
141
|
-
"email",
|
|
142
|
-
"range",
|
|
143
|
-
"url",
|
|
144
|
-
"colour",
|
|
145
|
-
"file",
|
|
146
|
-
"starRating",
|
|
147
|
-
"heading",
|
|
148
|
-
"paragraph",
|
|
149
|
-
],
|
|
150
|
-
},
|
|
151
|
-
option: {
|
|
152
|
-
type: mongoose.Schema.Types.Mixed,
|
|
153
|
-
},
|
|
154
|
-
},
|
|
155
|
-
],
|
|
156
|
-
});
|
|
157
|
-
const workspaceSchema = new mongoose.Schema(
|
|
158
|
-
{
|
|
159
|
-
name: {
|
|
160
|
-
type: String,
|
|
161
|
-
required: true,
|
|
162
|
-
trim: true,
|
|
163
|
-
},
|
|
164
|
-
iconUrl: { type: String, default: "" },
|
|
165
|
-
thumbUrl: { type: String, default: "" },
|
|
166
|
-
createdBy: {
|
|
167
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
168
|
-
ref: "User",
|
|
169
|
-
default: null,
|
|
170
|
-
},
|
|
171
|
-
updatedBy: {
|
|
172
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
173
|
-
ref: "User",
|
|
174
|
-
default: null,
|
|
175
|
-
},
|
|
176
|
-
productsCount: { type: Number, default: 0 },
|
|
177
|
-
ordersCount: { type: Number, default: 0 },
|
|
178
|
-
shippers: [{ type: String, trim: true }],
|
|
179
|
-
socialProfiles: [],
|
|
180
|
-
shiftConfigurations: [shiftSchema],
|
|
181
|
-
kpiConfiguration: {
|
|
182
|
-
type: Map,
|
|
183
|
-
of: kpiSchema,
|
|
184
|
-
default: {},
|
|
185
|
-
},
|
|
186
|
-
members: [],
|
|
187
|
-
contact: String,
|
|
188
|
-
email: String,
|
|
189
|
-
address: String,
|
|
190
|
-
websiteUrl: String,
|
|
191
|
-
facebookUrl: String,
|
|
192
|
-
twitterUrl: String,
|
|
193
|
-
instagramUrl: String,
|
|
194
|
-
isDeleted: { type: Boolean, default: false },
|
|
195
|
-
businessHours: {
|
|
196
|
-
startTime: { type: String, default: "" },
|
|
197
|
-
endTime: { type: String, default: "" },
|
|
198
|
-
},
|
|
199
|
-
remarks: [
|
|
200
|
-
{
|
|
201
|
-
reason: { type: String, default: "" },
|
|
202
|
-
type: { type: String, default: "" },
|
|
203
|
-
color: { type: String, default: "" },
|
|
204
|
-
},
|
|
205
|
-
],
|
|
206
|
-
chatGptApiKey: String,
|
|
207
|
-
skuSeparator: { type: String, default: "-" },
|
|
208
|
-
uniqueNo: { type: Number, default: 0 },
|
|
209
|
-
webhookStatus: { type: String, default: "" },
|
|
210
|
-
businessCategory: { type: String, default: "" },
|
|
211
|
-
numberOfProducts: { type: Number, default: 0 },
|
|
212
|
-
monthlyOrders: { type: Number, default: 0 },
|
|
213
|
-
queueTracking: { type: Boolean, default: false },
|
|
214
|
-
orderConfiguration: { type: String, default: "" },
|
|
215
|
-
defaultModule: { type: String, default: "dashboard" },
|
|
216
|
-
resolutionReasonCategories: {
|
|
217
|
-
type: [ResolutionReasonCategorySchema],
|
|
218
|
-
default: [],
|
|
219
|
-
},
|
|
220
|
-
feedbackDynamicFields: [feedbackFormSchema],
|
|
221
|
-
dynamicFieldsTemplate: [
|
|
222
|
-
{
|
|
223
|
-
groupName: { type: String, required: true, trim: true },
|
|
224
|
-
fields: [
|
|
225
|
-
{
|
|
226
|
-
fieldName: {
|
|
227
|
-
type: String,
|
|
228
|
-
required: true,
|
|
229
|
-
trim: true,
|
|
230
|
-
},
|
|
231
|
-
required: {
|
|
232
|
-
type: Boolean,
|
|
233
|
-
default: false,
|
|
234
|
-
},
|
|
235
|
-
enabled: {
|
|
236
|
-
type: Boolean,
|
|
237
|
-
default: true,
|
|
238
|
-
},
|
|
239
|
-
createdBy: {
|
|
240
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
241
|
-
ref: "User",
|
|
242
|
-
default: null,
|
|
243
|
-
},
|
|
244
|
-
updatedBy: {
|
|
245
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
246
|
-
ref: "User",
|
|
247
|
-
default: null,
|
|
248
|
-
},
|
|
249
|
-
fieldType: {
|
|
250
|
-
type: String,
|
|
251
|
-
enum: [
|
|
252
|
-
"text",
|
|
253
|
-
"autocomplete",
|
|
254
|
-
"radio",
|
|
255
|
-
"text area",
|
|
256
|
-
"number",
|
|
257
|
-
"date",
|
|
258
|
-
"time",
|
|
259
|
-
"email",
|
|
260
|
-
"range",
|
|
261
|
-
"url",
|
|
262
|
-
"colour",
|
|
263
|
-
"file",
|
|
264
|
-
],
|
|
265
|
-
},
|
|
266
|
-
option: {
|
|
267
|
-
type: mongoose.Schema.Types.Mixed,
|
|
268
|
-
},
|
|
269
|
-
isPublic: {
|
|
270
|
-
type: Boolean,
|
|
271
|
-
default: false,
|
|
272
|
-
},
|
|
273
|
-
},
|
|
274
|
-
],
|
|
275
|
-
},
|
|
276
|
-
],
|
|
277
|
-
crmVisibility: {
|
|
278
|
-
type: String,
|
|
279
|
-
enum: ["everyone", "assignee"],
|
|
280
|
-
default: "everyone",
|
|
281
|
-
},
|
|
282
|
-
defaultShift: { type: String, default: "" },
|
|
283
|
-
},
|
|
284
|
-
{ timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
|
|
285
|
-
);
|
|
286
|
-
const commonOptions = {
|
|
287
|
-
type: String,
|
|
288
|
-
trim: true,
|
|
289
|
-
default: "",
|
|
290
|
-
};
|
|
291
|
-
workspaceSchema.add({
|
|
292
|
-
contact: commonOptions,
|
|
293
|
-
email: commonOptions,
|
|
294
|
-
address: commonOptions,
|
|
295
|
-
websiteUrl: commonOptions,
|
|
296
|
-
facebookUrl: commonOptions,
|
|
297
|
-
twitterUrl: commonOptions,
|
|
298
|
-
instagramUrl: commonOptions,
|
|
299
|
-
chatGptApiKey: commonOptions,
|
|
300
|
-
});
|
|
301
|
-
|
|
302
|
-
workspaceSchema.virtual("integrations", {
|
|
303
|
-
ref: "Integration",
|
|
304
|
-
localField: "_id",
|
|
305
|
-
foreignField: "workspaceId",
|
|
306
|
-
});
|
|
307
|
-
const Workspace = mongoose.model("Workspace", workspaceSchema);
|
|
308
|
-
module.exports = Workspace;
|