aloux-iam 0.0.17 → 0.0.19
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.
- package/lib/services/auth.js +3 -0
- package/package.json +1 -1
package/lib/services/auth.js
CHANGED
|
@@ -7,6 +7,7 @@ const bcrypt = require('bcryptjs')
|
|
|
7
7
|
const dayjs = require("dayjs")
|
|
8
8
|
const fs = require("fs")
|
|
9
9
|
const jwt = require("jsonwebtoken")
|
|
10
|
+
const mongoose = require("mongoose")
|
|
10
11
|
|
|
11
12
|
const self = module.exports
|
|
12
13
|
|
|
@@ -162,6 +163,8 @@ self.me = async (req, res) => {
|
|
|
162
163
|
// { path: "_functions", populate: [{ path: "_permissions" }, { path: "_menus" }] },
|
|
163
164
|
// ]).lean()
|
|
164
165
|
|
|
166
|
+
const _id = req.user._id
|
|
167
|
+
|
|
165
168
|
// Valida que los modelos existan hantes de hacer una consulta con populate
|
|
166
169
|
if (mongoose.modelNames().includes('Business') && mongoose.modelNames().includes('Client')) {
|
|
167
170
|
user = await User.findOne({ _id }).populate([{ path: "_functions", populate: [{ path: "_permissions" }, { path: "_menus" }] },{ path: "_business" }, { path: "_client" }]).select("-pwd -tokens").lean()
|