From d026a6a06b686850848a3186172fafa1e71f1464 Mon Sep 17 00:00:00 2001 From: CharlizeHanekom Date: Sat, 28 Sep 2024 07:53:26 +0200 Subject: [PATCH] Fixed like comment --- backend/src/Likes/likes.services.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/src/Likes/likes.services.js b/backend/src/Likes/likes.services.js index d8a3ffb5..608361f3 100644 --- a/backend/src/Likes/likes.services.js +++ b/backend/src/Likes/likes.services.js @@ -50,7 +50,7 @@ exports.getLikesOfComment = async(commentId) => { try { const result = await session.run( `MATCH (u:User)-[:LIKES]->(c:Comment) - WHERE c.commentId = $commentId + WHERE c.comId = $commentId RETURN count(u) AS likeCount`, { commentId } ); @@ -199,7 +199,7 @@ exports.toggleLikeComment = async(uid, commentId) => { //Doesnt work try { const result = await session.run( `MATCH (u:User), (c:Comment) - WHERE u.uid = $uid AND c.commentId = $commentId + WHERE u.uid = $uid AND c.comId = $commentId MATCH (u)-[like:LIKES]->(c) RETURN like`, { uid, commentId } @@ -208,7 +208,7 @@ exports.toggleLikeComment = async(uid, commentId) => { //Doesnt work if (result.records.length > 0) { await session.run( `MATCH (u:User), (c:Comment) - WHERE u.uid = $uid AND c.commentId = $commentId + WHERE u.uid = $uid AND c.comId = $commentId MATCH (u)-[like:LIKES]->(c) DETACH DELETE like`, { uid, commentId } @@ -217,7 +217,7 @@ exports.toggleLikeComment = async(uid, commentId) => { //Doesnt work } else { await session.run( `MATCH (u:User), (c:Comment) - WHERE u.uid = $uid AND c.commentId = $commentId + WHERE u.uid = $uid AND c.comId = $commentId MERGE (u)-[:LIKES]->(c)`, { uid, commentId } );