fix
This commit is contained in:
@@ -78,7 +78,7 @@ module.exports.update =[
|
||||
// msg: _sr.fa.response.success_save,
|
||||
// data
|
||||
// })
|
||||
res.status(201).json(data)
|
||||
res.status(200).json(data)
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ module.exports.sendRequest = [
|
||||
userId:req.user_id
|
||||
})
|
||||
// res.status(200).json({ msg:_sr.fa.response.success_save, data})
|
||||
res.status(201).json(data)
|
||||
res.status(200).json(data)
|
||||
|
||||
}else{
|
||||
res.status(400).json({ msg: "امتیاز شما برای این مورد کافی نیست" })
|
||||
|
||||
@@ -66,7 +66,7 @@ module.exports.deleteCard = [
|
||||
{ new:true }
|
||||
).select('id cardBank')
|
||||
// res.status(200).json({ msg: "با موفقیت حذف شد ", data: userData })
|
||||
res.status(201).json(userData)
|
||||
res.status(200).json(userData)
|
||||
|
||||
}
|
||||
]
|
||||
@@ -103,7 +103,7 @@ module.exports.changeStatus = [
|
||||
{ new: true }
|
||||
).select('first_name last_name')
|
||||
// res.status(200).json({ msg: 'با موفقیت به روز شد', data: userData })
|
||||
res.status(201).json(userData)
|
||||
res.status(200).json(userData)
|
||||
|
||||
|
||||
}else{
|
||||
@@ -135,7 +135,7 @@ module.exports.changeStatus = [
|
||||
{ new: true })
|
||||
|
||||
// res.status(200).json({ msg: 'با موفقیت به روز شد', data })
|
||||
res.status(201).json(data)
|
||||
res.status(200).json(data)
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -24,15 +24,15 @@ module.exports.getAll = 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 : ""
|
||||
|
||||
|
||||
const score = await Score.find({
|
||||
userId: req.user_id,
|
||||
$or: [
|
||||
{ title: { $regex: search } },
|
||||
{ score: { $regex: search } },
|
||||
],
|
||||
// $or: [
|
||||
// { title: { $regex: search } },
|
||||
// { score: { $regex: search } },
|
||||
// ],
|
||||
}).skip(page).limit(rows);
|
||||
const total = Math.ceil((await Score.countDocuments({ userId: req.user_id })))
|
||||
|
||||
|
||||
@@ -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 })
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ const deletebrand = async (req, res) => {
|
||||
|
||||
await brand.deleteOne();
|
||||
|
||||
res.status(201).json(brand);
|
||||
res.status(200).json(brand);
|
||||
|
||||
};
|
||||
|
||||
|
||||
+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,
|
||||
|
||||
Reference in New Issue
Block a user