fix bug
This commit is contained in:
@@ -16,6 +16,7 @@ const {
|
||||
generateRandomDigits
|
||||
} = require('../plugins/controllersHelperFunctions')
|
||||
const _faSr = _sr.fa
|
||||
const { notifyAdmin } = require('../WebSocket/controllers/admin_EventsController')
|
||||
|
||||
|
||||
|
||||
@@ -158,6 +159,8 @@ module.exports.register_user = [
|
||||
|
||||
const user = new User(data)
|
||||
await user.save()
|
||||
notifyAdmin('pendingUsers')
|
||||
|
||||
return res.json({ message: _faSr.response.success_save })
|
||||
} catch (err) {
|
||||
const registerFailurMsg = 'مشکلی در ثبت نام پیش آمده، لطفا مجددا تلاش کنید'
|
||||
@@ -295,7 +298,7 @@ module.exports.send_otp = [
|
||||
const user = await User.findOne({ mobile_number })
|
||||
if (!user) throw new Error(_sr.fa.not_found.user_id)
|
||||
await sendConfirmationSMS(user.id)
|
||||
res.status(200).json({msg:"ok"})
|
||||
res.status(200).json({ msg: "ok" })
|
||||
} catch (err) {
|
||||
if (err) return res500(res, err)
|
||||
}
|
||||
@@ -373,14 +376,14 @@ module.exports.getUsersForAdmin = async (req, res) => {
|
||||
res.status(200).json(user)
|
||||
}
|
||||
module.exports.getPendingUsersForAdmin = async (req, res) => {
|
||||
const user = await User.find({active:false}).sort({ active: 1, created_at: -1 }).select('-password -token -otp -seenByAdmin -cardBank')
|
||||
const user = await User.find({ active: false }).sort({ active: 1, created_at: -1 }).select('-password -token -otp -seenByAdmin -cardBank')
|
||||
res.status(200).json(user)
|
||||
}
|
||||
module.exports.getUserForAdmin = async (req, res) => {
|
||||
const user = await User.findById(req.params.id).select('-password -token -otp -seenByAdmin')
|
||||
if (!user) {
|
||||
return res.status(404).json({ msg: _sr.fa.not_found.user_id })
|
||||
}else {
|
||||
} else {
|
||||
user.seenByAdmin = true
|
||||
user.save()
|
||||
res.status(200).json(user)
|
||||
@@ -401,6 +404,7 @@ module.exports.activeUser = [
|
||||
{ new: true }).select('-password -token -otp -seenByAdmin')
|
||||
if (!data) return res.status(404).json({ msg: _sr.fa.not_found.user_id })
|
||||
|
||||
notifyAdmin('pendingUsers')
|
||||
|
||||
res.status(200).json(data)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user