Skip to content

Commit c803acf

Browse files
authored
Merge pull request #10 from MinJun916/express-신민준
fix: restore missing connection between comment and article
2 parents 29d12f6 + 3590b7f commit c803acf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/controllers/commentControllers.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ import prisma from '../lib/prisma.js';
22

33
export const createComment = async (req, res, next) => {
44
try {
5-
const { content } = req.body;
5+
const { content, articleId } = req.body;
66

77
if (!content) {
88
return res.status(400).json({ success: false, message: 'Content is required' });
99
}
1010

11-
const comment = await prisma.comment.create({ data: { content } });
11+
const comment = await prisma.comment.create({ data: { content, articleId } });
1212
res.status(201).json({ success: true, data: comment });
1313
} catch (error) {
1414
next(error);

0 commit comments

Comments
 (0)