shuttlepro-shared 1.5.22 → 1.5.24
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/models/Order.js +12 -0
- package/models/UserSession.js +8 -0
- package/package.json +1 -1
package/models/Order.js
CHANGED
|
@@ -18,6 +18,9 @@ const getPhoneRegex = (phone) => {
|
|
|
18
18
|
);
|
|
19
19
|
};
|
|
20
20
|
const _ = require("lodash");
|
|
21
|
+
const {
|
|
22
|
+
findWorkspaceById,
|
|
23
|
+
} = require("../common/repositories/workspace.repository");
|
|
21
24
|
|
|
22
25
|
const ShipperInformation = new Schema({
|
|
23
26
|
_id: false,
|
|
@@ -227,6 +230,15 @@ OrderSchema.post("findOneAndUpdate", async function (doc) {
|
|
|
227
230
|
|
|
228
231
|
const markOrUnMarkOrderAsDuplicate = async (doc) => {
|
|
229
232
|
try {
|
|
233
|
+
if (!doc?.workspaceId) {
|
|
234
|
+
return { code: 200 };
|
|
235
|
+
}
|
|
236
|
+
const workspace = await findWorkspaceById(doc.workspaceId.toString(), [
|
|
237
|
+
"allowedModules",
|
|
238
|
+
]);
|
|
239
|
+
if (!workspace?.allowedModules?.includes("oms")) {
|
|
240
|
+
return { code: 200 };
|
|
241
|
+
}
|
|
230
242
|
if (["pending", "cancelled", "published"].includes(doc?.statusType)) {
|
|
231
243
|
if (["cancelled"].includes(doc?.statusType)) {
|
|
232
244
|
await Order.updateOne(
|
package/models/UserSession.js
CHANGED
|
@@ -39,6 +39,14 @@ const userSessionSchema = new mongoose.Schema(
|
|
|
39
39
|
type: String,
|
|
40
40
|
default: "web",
|
|
41
41
|
},
|
|
42
|
+
deviceId: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: "",
|
|
45
|
+
},
|
|
46
|
+
isMobile: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: false,
|
|
49
|
+
},
|
|
42
50
|
},
|
|
43
51
|
{ timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
|
|
44
52
|
);
|