shuttlepro-shared 1.3.22 → 1.3.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.
@@ -2,7 +2,7 @@ const { UserRole } = require("../../models/UserRole");
2
2
  const { getRedisData, setRedisData } = require("../../config/redis");
3
3
 
4
4
  const defaultSelect =
5
- "iconUrl thumbUrl name productsCount ordersCount contact email address websiteUrl facebookUrl twitterUrl instagramUrl members defaultModule allowedModules";
5
+ "iconUrl thumbUrl name productsCount ordersCount contact email address websiteUrl facebookUrl twitterUrl instagramUrl members defaultModule";
6
6
 
7
7
  // Cache keys
8
8
  const MEMBERS = "members";
@@ -31,42 +31,29 @@ exports.checkPermission = async (req, res, next, values) => {
31
31
  const accessToken = token.split(" ")[1];
32
32
  const body = getBodyFromDecodeToken(accessToken);
33
33
  if (body) {
34
- req.user = {
35
- id: body.id,
36
- type: body.type,
37
- email: body.email,
38
- firstName: body.firstName,
39
- lastName: body.lastName,
40
- suspended: body.suspended,
41
- isVerified: body.isVerified,
42
- role: body.role,
43
- isMember: body.isMember,
44
- uuid: body.uuid,
45
- };
46
- return next();
47
- // const { module, action } = values;
48
- // const moduleObj = getModule(body, module);
49
- // if (moduleObj && moduleObj.includes(action)) {
50
- // req.user = {
51
- // id: body.id,
52
- // type: body.type,
53
- // email: body.email,
54
- // firstName: body.firstName,
55
- // lastName: body.lastName,
56
- // suspended: body.suspended,
57
- // isVerified: body.isVerified,
58
- // role: body.role,
59
- // isMember: body.isMember,
60
- // uuid: body.uuid,
61
- // };
62
- // req.currentModulePermission = moduleObj;
63
- // return next();
64
- // } else {
65
- // return res.status(HttpStatusCode.UNAUTHORIZED).json({
66
- // code: HttpStatusCode.UNAUTHORIZED,
67
- // message: GenericMessages.PERMISSION_DENIED,
68
- // });
69
- // }
34
+ const { module, action } = values;
35
+ const moduleObj = getModule(body, module);
36
+ if (moduleObj && moduleObj.includes(action)) {
37
+ req.user = {
38
+ id: body.id,
39
+ type: body.type,
40
+ email: body.email,
41
+ firstName: body.firstName,
42
+ lastName: body.lastName,
43
+ suspended: body.suspended,
44
+ isVerified: body.isVerified,
45
+ role: body.role,
46
+ isMember: body.isMember,
47
+ uuid: body.uuid,
48
+ };
49
+ req.currentModulePermission = moduleObj;
50
+ return next();
51
+ } else {
52
+ return res.status(HttpStatusCode.UNAUTHORIZED).json({
53
+ code: HttpStatusCode.UNAUTHORIZED,
54
+ message: GenericMessages.PERMISSION_DENIED,
55
+ });
56
+ }
70
57
  }
71
58
  return res.status(HttpStatusCode.UNAUTHORIZED).json({
72
59
  code: HttpStatusCode.UNAUTHORIZED,
@@ -8,6 +8,7 @@ const CustomerProfileSchema = new Schema(
8
8
  picture: { type: String, default: "" },
9
9
  fbId: { type: String, default: "" },
10
10
  igId: { type: String, default: "" },
11
+ profiles: [],
11
12
  totalOrders: { type: Number, default: 0 },
12
13
  totalConversations: { type: Number, default: 0 },
13
14
  totalTickets: { type: Number, default: 0 },
@@ -191,6 +191,18 @@ const workspaceSchema = new mongoose.Schema(
191
191
  facebookUrl: String,
192
192
  twitterUrl: String,
193
193
  instagramUrl: String,
194
+ highRiskOrderAmount: {
195
+ type: Number,
196
+ default: 100000,
197
+ },
198
+ highRiskOrderQuantity: {
199
+ type: Number,
200
+ default: 15,
201
+ },
202
+ highRiskAcceptanceRatio: {
203
+ type: Number,
204
+ default: 75,
205
+ },
194
206
  isDeleted: { type: Boolean, default: false },
195
207
  businessHours: {
196
208
  startTime: { type: String, default: "" },
@@ -280,7 +292,6 @@ const workspaceSchema = new mongoose.Schema(
280
292
  default: "everyone",
281
293
  },
282
294
  defaultShift: { type: String, default: "" },
283
- allowedModules: [],
284
295
  },
285
296
  { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
286
297
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shuttlepro-shared",
3
- "version": "1.3.22",
3
+ "version": "1.3.24",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {