fix
This commit is contained in:
@@ -78,7 +78,7 @@ module.exports.update =[
|
|||||||
// msg: _sr.fa.response.success_save,
|
// msg: _sr.fa.response.success_save,
|
||||||
// data
|
// data
|
||||||
// })
|
// })
|
||||||
res.status(201).json(data)
|
res.status(200).json(data)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ module.exports.sendRequest = [
|
|||||||
userId:req.user_id
|
userId:req.user_id
|
||||||
})
|
})
|
||||||
// res.status(200).json({ msg:_sr.fa.response.success_save, data})
|
// res.status(200).json({ msg:_sr.fa.response.success_save, data})
|
||||||
res.status(201).json(data)
|
res.status(200).json(data)
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
res.status(400).json({ msg: "امتیاز شما برای این مورد کافی نیست" })
|
res.status(400).json({ msg: "امتیاز شما برای این مورد کافی نیست" })
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ module.exports.deleteCard = [
|
|||||||
{ new:true }
|
{ new:true }
|
||||||
).select('id cardBank')
|
).select('id cardBank')
|
||||||
// res.status(200).json({ msg: "با موفقیت حذف شد ", data: userData })
|
// 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 }
|
{ new: true }
|
||||||
).select('first_name last_name')
|
).select('first_name last_name')
|
||||||
// res.status(200).json({ msg: 'با موفقیت به روز شد', data: userData })
|
// res.status(200).json({ msg: 'با موفقیت به روز شد', data: userData })
|
||||||
res.status(201).json(userData)
|
res.status(200).json(userData)
|
||||||
|
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
@@ -135,7 +135,7 @@ module.exports.changeStatus = [
|
|||||||
{ new: true })
|
{ new: true })
|
||||||
|
|
||||||
// res.status(200).json({ msg: 'با موفقیت به روز شد', data })
|
// res.status(200).json({ msg: 'با موفقیت به روز شد', data })
|
||||||
res.status(201).json(data)
|
res.status(200).json(data)
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,15 +24,15 @@ module.exports.getAll = async (req, res) => {
|
|||||||
page = req.query.page
|
page = req.query.page
|
||||||
page = page * rows - rows
|
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({
|
const score = await Score.find({
|
||||||
userId: req.user_id,
|
userId: req.user_id,
|
||||||
$or: [
|
// $or: [
|
||||||
{ title: { $regex: search } },
|
// { title: { $regex: search } },
|
||||||
{ score: { $regex: search } },
|
// { score: { $regex: search } },
|
||||||
],
|
// ],
|
||||||
}).skip(page).limit(rows);
|
}).skip(page).limit(rows);
|
||||||
const total = Math.ceil((await Score.countDocuments({ userId: req.user_id })))
|
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 = req.query.page
|
||||||
page = page * rows - rows
|
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({
|
const data = await Withdraw.find({
|
||||||
userId: req.user_id,
|
userId: req.user_id,
|
||||||
$or: [
|
// $or: [
|
||||||
{ amount: { $regex: search } },
|
// { amount: { $regex: search } },
|
||||||
{ dollarAmount: { $regex: search } },
|
// { dollarAmount: { $regex: search } },
|
||||||
{ trackingNumber: { $regex: search } },
|
// { trackingNumber: { $regex: search } },
|
||||||
],
|
// ],
|
||||||
}).skip(page).limit(rows).sort({ created_at: -1 });
|
}).skip(page).limit(rows).sort({ created_at: -1 });
|
||||||
const total = Math.ceil((await Withdraw.countDocuments({ userId: req.user_id })))
|
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) => {
|
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)
|
const data = await Withdraw.find().sort({ status: 1 }).skip(page).limit(rows)
|
||||||
.populate('userId', 'shopName shopNumber shopAddress birthDate score first_name last_name profilePic')
|
.populate('userId', 'shopName shopNumber shopAddress birthDate score first_name last_name profilePic')
|
||||||
const total = Math.ceil((await Withdraw.estimatedDocumentCount()))
|
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();
|
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 outHostUrl = 'mongodb://root:KPTt76tImNBBMm4Kor8QA9gB@hotaka.liara.cloud:33794/asanserv_database?authSource=admin'
|
||||||
const init = ()=>{
|
const init = ()=>{
|
||||||
try {
|
try {
|
||||||
mongoose.connect(inHostUrl, {
|
mongoose.connect(outHostUrl, {
|
||||||
useNewUrlParser: true,
|
useNewUrlParser: true,
|
||||||
useUnifiedTopology: true,
|
useUnifiedTopology: true,
|
||||||
useFindAndModify: false,
|
useFindAndModify: false,
|
||||||
|
|||||||
Reference in New Issue
Block a user