@riocrypto/common 1.0.415 → 1.0.417

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.
@@ -86,10 +86,12 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
86
86
  let businessUser;
87
87
  try {
88
88
  const User = yield (0, user_1.buildUser)(mongoose);
89
+ console.log(req.currentAuth);
89
90
  individualUser = yield User.findOne({
90
91
  phoneNumber: req.currentAuth.phoneNumber,
91
92
  attributes: { $ne: user_attribute_1.UserAttribute.deleted },
92
93
  });
94
+ console.log(individualUser);
93
95
  if (!individualUser) {
94
96
  throw new Error();
95
97
  }
@@ -119,6 +121,7 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
119
121
  businessUser = null;
120
122
  }
121
123
  const user = individualUser || businessUser;
124
+ console.log("final user is ", user);
122
125
  if (user) {
123
126
  req.user = user;
124
127
  }
@@ -131,6 +134,7 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
131
134
  if ((authorizationTypes.includes(authorization_type_1.AuthorizationType.User) ||
132
135
  authorizationTypes.includes(authorization_type_1.AuthorizationType.UserNoKYC)) &&
133
136
  ((_g = req.cookies) === null || _g === void 0 ? void 0 : _g.jwt)) {
137
+ console.log("chimichanga");
134
138
  throw new missing_user_error_1.MissingUserError();
135
139
  }
136
140
  console.log("throwing");
@@ -40,7 +40,6 @@ const getOrder = (req, res, next, mongoose) => __awaiter(void 0, void 0, void 0,
40
40
  throw new not_found_error_1.NotFoundError();
41
41
  }
42
42
  if (req.order.userId !== ((_a = req.user) === null || _a === void 0 ? void 0 : _a.toJSON().id) && !req.currentAdminAuth) {
43
- console.log("aqui men");
44
43
  throw new not_authorized_error_1.NotAuthorizedError();
45
44
  }
46
45
  next();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common",
3
- "version": "1.0.415",
3
+ "version": "1.0.417",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",