We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 29d12f6 + 3590b7f commit c803acfCopy full SHA for c803acf
src/controllers/commentControllers.js
@@ -2,13 +2,13 @@ import prisma from '../lib/prisma.js';
2
3
export const createComment = async (req, res, next) => {
4
try {
5
- const { content } = req.body;
+ const { content, articleId } = req.body;
6
7
if (!content) {
8
return res.status(400).json({ success: false, message: 'Content is required' });
9
}
10
11
- const comment = await prisma.comment.create({ data: { content } });
+ const comment = await prisma.comment.create({ data: { content, articleId } });
12
res.status(201).json({ success: true, data: comment });
13
} catch (error) {
14
next(error);
0 commit comments