import prisma from '~/lib/prisma'; export default defineEventHandler(async (event) => { const id = event.context.params?.id; const body = await readBody(event); if (!id) { return { success: false, message: 'Invalid comment ID.', }; } try { const updatedComment = await prisma.comment.update({ where: { id }, data: { content: body.content, likes: body.likes, dislikes: body.dislikes, }, }); return { success: true, message: 'Comment updated successfully', data: updatedComment, }; } catch (error) { console.error('Error updating comment:', error); return { success: false, message: 'An error occurred while updating the comment', error: error.message, }; } });