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,30 @@
import prisma from '~/lib/prisma';
export default defineEventHandler(async (event) => {
const id = event.context.params?.id;
if (!id) {
return {
success: false,
message: 'Invalid comment ID.',
};
}
try {
await prisma.comment.delete({
where: { id },
});
return {
success: true,
message: 'Comment deleted successfully',
};
} catch (error) {
console.error('Error deleting comment:', error);
return {
success: false,
message: 'An error occurred while deleting the comment',
error: error.message,
};
}
});