@riocrypto/common-server 1.0.1219 → 1.0.1220

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.
@@ -1,3 +1,4 @@
1
1
  import { Request } from "express";
2
2
  import { UserDoc } from "../models/user";
3
- export declare const getUser: (req: Request, userId?: string) => Promise<UserDoc | undefined | null>;
3
+ import { Mongoose } from "mongoose";
4
+ export declare const getUser: (mongoose: Mongoose, req: Request, userId?: string) => Promise<UserDoc | undefined | null>;
@@ -8,24 +8,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
11
  Object.defineProperty(exports, "__esModule", { value: true });
15
12
  exports.getUser = void 0;
16
13
  const user_1 = require("../models/user");
17
- const mongoose_1 = __importDefault(require("mongoose"));
18
- const getUser = (req, userId) => __awaiter(void 0, void 0, void 0, function* () {
14
+ const getUser = (mongoose, req, userId) => __awaiter(void 0, void 0, void 0, function* () {
19
15
  var _a, _b;
20
16
  console.log("User id is ", userId);
21
17
  if (!userId) {
22
18
  return req.user;
23
19
  }
24
20
  else {
25
- console.log("chchch");
26
- const User = (0, user_1.buildUser)(mongoose_1.default);
21
+ const User = (0, user_1.buildUser)(mongoose);
27
22
  const user = yield User.findById(userId);
28
- console.log("pp");
29
23
  if (req.admin ||
30
24
  req.validClusterApiKey ||
31
25
  (user === null || user === void 0 ? void 0 : user.id) === ((_a = req.user) === null || _a === void 0 ? void 0 : _a.id) ||
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.1219",
3
+ "version": "1.0.1220",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",