Gps User Page
This commit is contained in:
@@ -65,7 +65,7 @@ module.exports.getAllNotifs = async socket => {
|
||||
const newGuaranteeReports = allData[7]
|
||||
const newComplaintReports = allData[8]
|
||||
const newWithdrawRequest = allData[9]
|
||||
const newGpsRequest = allData[10]
|
||||
const pendingUsers = allData[10]
|
||||
const newAwardRequest = allData[11]
|
||||
const newInstallDeviceRequest = allData[12]
|
||||
|
||||
@@ -81,7 +81,7 @@ module.exports.getAllNotifs = async socket => {
|
||||
newGuaranteeReports,
|
||||
newComplaintReports,
|
||||
newWithdrawRequest,
|
||||
newGpsRequest,
|
||||
pendingUsers,
|
||||
newAwardRequest,
|
||||
newInstallDeviceRequest
|
||||
})
|
||||
|
||||
@@ -369,10 +369,13 @@ module.exports.getCurrent = async (req, res) => {
|
||||
}
|
||||
|
||||
module.exports.getUsersForAdmin = async (req, res) => {
|
||||
const user = await User.find({}).sort({ active: 1, created_at: -1 }).select('-password -token -otp -seenByAdmin')
|
||||
const user = await User.find({}).sort({ active: 1, created_at: -1 }).select('-password -token -otp -seenByAdmin -cardBank')
|
||||
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')
|
||||
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) {
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ const inHostUrl = 'mongodb://root:KPTt76tImNBBMm4Kor8QA9gB@asan-service:27017/as
|
||||
const outHostUrl = 'mongodb://root:KPTt76tImNBBMm4Kor8QA9gB@hotaka.liara.cloud:33794/asanserv_database?authSource=admin'
|
||||
const init = ()=>{
|
||||
try {
|
||||
mongoose.connect(inHostUrl, {
|
||||
mongoose.connect(outHostUrl, {
|
||||
useNewUrlParser: true,
|
||||
useUnifiedTopology: true,
|
||||
useFindAndModify: false,
|
||||
|
||||
@@ -42,6 +42,7 @@ const userGPS = require('../controllers/GPS.User')
|
||||
/// /////////////// User
|
||||
|
||||
router.get('/gps/users',hasPermission('gps'), userGPS.getUsersForAdmin)
|
||||
router.get('/gps/users/pending',hasPermission('gps'), userGPS.getPendingUsersForAdmin)
|
||||
router.get('/gps/users/:id',hasPermission('gps'), userGPS.getUserForAdmin)
|
||||
|
||||
router.patch('/gps/users/:id/:status',hasPermission('gps'), userGPS.activeUser)
|
||||
|
||||
Reference in New Issue
Block a user