add interactions to comments
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing

This commit is contained in:
Do-raa
2024-12-23 15:44:36 +01:00
parent 6d6d70295d
commit e24b3e1955
22 changed files with 3963 additions and 3410 deletions

View File

@@ -0,0 +1,24 @@
import prisma from '~/lib/prisma';
export default defineEventHandler(async (event) => {
const query = getQuery(event);
const { articleId } = query;
try {
const comments = await prisma.comment.findMany({
where: articleId ? { articleId: String(articleId) } : undefined,
});
return {
success: true,
data: comments,
};
} catch (error) {
console.error('Error fetching comments:', error);
return {
success: false,
message: 'An error occurred while fetching comments',
error: error.message,
};
}
});