shuttlepro-shared 1.5.22 → 1.5.23

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 (2) hide show
  1. package/models/Order.js +12 -0
  2. 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shuttlepro-shared",
3
- "version": "1.5.22",
3
+ "version": "1.5.23",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {