fix
This commit is contained in:
@@ -60,19 +60,19 @@ module.exports.getAllForUser = async (req, res) => {
|
||||
page = req.query.page
|
||||
page = page * rows - rows
|
||||
}
|
||||
const search = req.query?.search ? req.query.search : ""
|
||||
// const search = req.query?.search ? req.query.search : 0
|
||||
|
||||
|
||||
const data = await Withdraw.find({
|
||||
userId: req.user_id,
|
||||
$or: [
|
||||
{ amount: { $regex: search } },
|
||||
{ dollarAmount: { $regex: search } },
|
||||
{ trackingNumber: { $regex: search } },
|
||||
],
|
||||
// $or: [
|
||||
// { amount: { $regex: search } },
|
||||
// { dollarAmount: { $regex: search } },
|
||||
// { trackingNumber: { $regex: search } },
|
||||
// ],
|
||||
}).skip(page).limit(rows).sort({ created_at: -1 });
|
||||
const total = Math.ceil((await Withdraw.countDocuments({ userId: req.user_id })))
|
||||
res.status(201).json({ data, total })
|
||||
res.status(200).json({ data, total })
|
||||
}
|
||||
|
||||
module.exports.getAllForAdmin = async (req, res) => {
|
||||
@@ -96,7 +96,7 @@ module.exports.getAllForAdmin = async (req, res) => {
|
||||
const data = await Withdraw.find().sort({ status: 1 }).skip(page).limit(rows)
|
||||
.populate('userId', 'shopName shopNumber shopAddress birthDate score first_name last_name profilePic')
|
||||
const total = Math.ceil((await Withdraw.estimatedDocumentCount()))
|
||||
res.status(201).json({ data, total })
|
||||
res.status(200).json({ data, total })
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user