Skip to content

Commit

Permalink
Fixed like comment
Browse files Browse the repository at this point in the history
  • Loading branch information
CharlizeHanekom committed Sep 28, 2024
1 parent cb2952e commit d026a6a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions backend/src/Likes/likes.services.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
);
Expand Down Expand Up @@ -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 }
Expand All @@ -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 }
Expand All @@ -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 }
);
Expand Down

0 comments on commit d026a6a

Please sign in to comment.