Fix populate
This commit is contained in:
@@ -48,7 +48,7 @@ module.exports.getAllForUser = async(req, res)=>{
|
|||||||
}
|
}
|
||||||
|
|
||||||
module.exports.getAllForAdmin = async(req, res)=>{
|
module.exports.getAllForAdmin = async(req, res)=>{
|
||||||
const data = await InstalledDevice.find({}).sort({status: 1}).populate('deviceId userId')
|
const data = await InstalledDevice.find({}).sort({status: 1}).populate('deviceId').populate('userId', 'shopName shopNumber shopAddress birthDate score first_name last_name profilePic')
|
||||||
res.status(200).json(data)
|
res.status(200).json(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ module.exports.gpsRequest = [
|
|||||||
|
|
||||||
module.exports.getAllRequest = [
|
module.exports.getAllRequest = [
|
||||||
async (req, res) => {
|
async (req, res) => {
|
||||||
const data = await RequestGPS.find({}).sort({ status: 1 }).populate('userId')
|
const data = await RequestGPS.find({}).sort({ status: 1 }).populate('userId', 'shopName shopNumber shopAddress birthDate score first_name last_name profilePic')
|
||||||
res.status(200).json(data)
|
res.status(200).json(data)
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -46,7 +46,7 @@ module.exports.getOneRequest = [
|
|||||||
],
|
],
|
||||||
checkValidations(validationResult),
|
checkValidations(validationResult),
|
||||||
async (req, res) => {
|
async (req, res) => {
|
||||||
const data = await RequestGPS.findById(req.params.id).populate('userId')
|
const data = await RequestGPS.findById(req.params.id).populate('userId', 'shopName shopNumber shopAddress birthDate score first_name last_name profilePic')
|
||||||
res.status(200).json(data)
|
res.status(200).json(data)
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ module.exports.getAllForUser = async (req, res) => {
|
|||||||
|
|
||||||
module.exports.getAllForAdmin = async (req, res) => {
|
module.exports.getAllForAdmin = async (req, res) => {
|
||||||
|
|
||||||
const requests = await Withdraw.find().sort({ status: 1 }).populate('userId')
|
const requests = await Withdraw.find().sort({ status: 1 }).populate('userId', 'shopName shopNumber shopAddress birthDate score first_name last_name profilePic')
|
||||||
|
|
||||||
res.status(201).json(requests)
|
res.status(201).json(requests)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user