Skip to content

Commit 5e85b18

Browse files
authored
Merge pull request #23 from osamhack2022-v2/mobile
Pouring mobile changes into web
2 parents ea92107 + df8d15f commit 5e85b18

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+11345
-818
lines changed

back-end/controllers/commentControllers.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,7 @@ const ReportM = require("../models/reportModel");
66
//@route POST /api/comment
77
//@access Protected
88
const addComment = asyncHandler(async (req, res) => {
9-
const {
10-
Type,
11-
Content,
12-
Title
13-
} = req.body;
9+
const { Type, Content, Title } = req.body;
1410

1511
if (!Type || !Content || !Title) {
1612
res.status(400);
@@ -19,26 +15,30 @@ const addComment = asyncHandler(async (req, res) => {
1915

2016
User = req.user._id;
2117

22-
report = await Report.find({ Title: { $eq: keyword }}).find({Unit: {$eq: req.user.Unit}});
18+
report = await Report.find({ Title: { $eq: keyword } }).find({
19+
Unit: { $eq: req.user.Unit },
20+
});
2321

2422
Report = report._id;
2523

2624
const comment = await Comment.create({
2725
User,
2826
Type,
2927
Content,
30-
report
28+
report,
3129
});
3230

3331
const editReport = await ReportM.findByIdAndUpdate(
34-
report._id, {
32+
report._id,
33+
{
3534
$push: {
36-
Comments: comment
35+
Comments: comment,
3736
},
38-
}, {
37+
},
38+
{
3939
new: true,
4040
}
41-
)
41+
);
4242

4343
if (editReport && editUnit && editUser) {
4444
res.status(201).send(comment);
@@ -49,5 +49,5 @@ const addComment = asyncHandler(async (req, res) => {
4949
});
5050

5151
module.exports = {
52-
addComment
52+
addComment,
5353
};

0 commit comments

Comments
 (0)