This commit is contained in:
Swift
2024-02-25 01:32:03 +03:30
parent 994e7f8d97
commit 0867b7ab89
2 changed files with 40 additions and 12 deletions
+8 -4
View File
@@ -70,7 +70,7 @@ const { fullName, national, phoneNumber, email, receptionCode, caption } = req.
module.exports.getsComplaint = [
async(req, res)=>{
const complaints = await Complaint.find({type:0})
const complaints = await Complaint.find({type:0}).populate('user', 'first_name last_name')
res.status(200).json(complaints)
@@ -84,7 +84,7 @@ module.exports.get = [
const complaint = await Complaint.findByIdAndUpdate(
req.params.id,
{read: true}
)
).populate('user', 'first_name last_name')
res.status(200).json(complaint)
@@ -94,10 +94,14 @@ module.exports.get = [
module.exports.put = [
async(req, res)=>{
const { complete } = req.body
const { complete, desc } = req.body
const complaint = await Complaint.findByIdAndUpdate(
req.params.id,
{complete},
{
complete,
user:req.user_id,
desc
},
{new:true}
)