This commit is contained in:
Mr Swift
2024-08-19 02:25:50 +03:30
parent dc2189c269
commit 59a608d616
8 changed files with 20 additions and 20 deletions
+1 -1
View File
@@ -78,7 +78,7 @@ module.exports.update =[
// msg: _sr.fa.response.success_save,
// data
// })
res.status(201).json(data)
res.status(200).json(data)
}
+1 -1
View File
@@ -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: "امتیاز شما برای این مورد کافی نیست" })
+1 -1
View File
@@ -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)
}
]
+2 -2
View File
@@ -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;
}
+5 -5
View File
@@ -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 })))
+8 -8
View File
@@ -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 })
}
+1 -1
View File
@@ -142,7 +142,7 @@ const deletebrand = async (req, res) => {
await brand.deleteOne();
res.status(201).json(brand);
res.status(200).json(brand);
};
+1 -1
View File
@@ -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,