Skip to content

Commit

Permalink
db error fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
cangndz75 committed Nov 28, 2024
1 parent ea36948 commit 28ebf22
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1656,8 +1656,8 @@ app.post('/communities/:communityId/send-request', async (req, res) => {
}
});

app.post('/posts/create', authenticateToken, upload.single('image'), async (req, res) => {
const { description, userId } = req.body;
app.post('/posts/create', authenticateToken, async (req, res) => {
const { description, userId, imageUrl } = req.body;

if (!description || !userId) {
return res.status(400).json({ message: 'Description and user ID are required.' });
Expand All @@ -1666,7 +1666,7 @@ app.post('/posts/create', authenticateToken, upload.single('image'), async (req,
try {
const newPost = new Post({
description,
imageUrl: req.file ? req.file.path : null,
imageUrl: imageUrl || null,
user: userId,
});

Expand Down

0 comments on commit 28ebf22

Please sign in to comment.