@riocrypto/common 1.0.419 → 1.0.420

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.
@@ -59,7 +59,7 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
59
59
  try {
60
60
  const User = yield (0, user_1.buildUser)(mongoose);
61
61
  individualUser = yield User.findOne({
62
- phoneNumber: req.currentAuth.phoneNumber,
62
+ authId: req.currentAuth.id,
63
63
  attributes: { $ne: user_attribute_1.UserAttribute.deleted },
64
64
  });
65
65
  }
@@ -69,7 +69,7 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
69
69
  try {
70
70
  const BusinessUser = yield (0, business_user_1.buildBusinessUser)(mongoose);
71
71
  businessUser = yield BusinessUser.findOne({
72
- phoneNumber: req.currentAuth.phoneNumber,
72
+ authId: req.currentAuth.id,
73
73
  attributes: { $ne: user_attribute_1.UserAttribute.deleted },
74
74
  });
75
75
  }
@@ -87,7 +87,7 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
87
87
  try {
88
88
  const User = yield (0, user_1.buildUser)(mongoose);
89
89
  individualUser = yield User.findOne({
90
- phoneNumber: req.currentAuth.phoneNumber,
90
+ authId: req.currentAuth.id,
91
91
  attributes: { $ne: user_attribute_1.UserAttribute.deleted },
92
92
  });
93
93
  if (!individualUser) {
@@ -104,7 +104,7 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
104
104
  try {
105
105
  const BusinessUser = yield (0, business_user_1.buildBusinessUser)(mongoose);
106
106
  businessUser = yield BusinessUser.findOne({
107
- phoneNumber: req.currentAuth.phoneNumber,
107
+ authId: req.currentAuth.id,
108
108
  attributes: { $ne: user_attribute_1.UserAttribute.deleted },
109
109
  });
110
110
  if (!businessUser) {
@@ -6,6 +6,7 @@ import { UserAttribute } from "../types/user-attribute";
6
6
  import { UserType } from "../types/user-type";
7
7
  import { Mongoose, Model, Document } from "mongoose";
8
8
  interface UserAttrs {
9
+ authId: string;
9
10
  type: UserType;
10
11
  firstName: string;
11
12
  lastName: string;
@@ -29,6 +30,7 @@ interface UserModel extends Model<UserDoc> {
29
30
  }
30
31
  interface UserDoc extends Document {
31
32
  _id: string;
33
+ authId: string;
32
34
  type: UserType;
33
35
  firstName: string;
34
36
  lastName: string;
@@ -7,6 +7,10 @@ const buildUser = (mongoose) => {
7
7
  return mongoose.model("User");
8
8
  }
9
9
  const userSchema = new mongoose.Schema({
10
+ authId: {
11
+ type: String,
12
+ required: true,
13
+ },
10
14
  type: {
11
15
  type: String,
12
16
  required: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common",
3
- "version": "1.0.419",
3
+ "version": "1.0.420",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",