|
|
|
@ -4,6 +4,7 @@ import org.example.models.User; |
|
|
|
|
import org.example.queryresults.PostQueryResult; |
|
|
|
|
import org.springframework.data.neo4j.repository.Neo4jRepository; |
|
|
|
|
import org.springframework.data.neo4j.repository.query.Query; |
|
|
|
|
import org.springframework.data.repository.query.Param; |
|
|
|
|
|
|
|
|
|
import java.util.Optional; |
|
|
|
|
|
|
|
|
@ -17,6 +18,16 @@ public interface UserRepository extends Neo4jRepository<User, Long> { |
|
|
|
|
"RETURN EXISTS((user)-[:ENROLLED_IN]->(course))") |
|
|
|
|
Boolean findEnrolmentStatus(String username, String identifier); |
|
|
|
|
|
|
|
|
|
@Query("match (u:User), (p:POST)\n" + |
|
|
|
|
"WHERE id(u) = $nameId AND id(p) = $postId\n" + |
|
|
|
|
"create (u) - [:LIKE] -> (p)") |
|
|
|
|
void createLike(@Param("nameId") Long nameId, @Param("postId*") Long postId); |
|
|
|
|
|
|
|
|
|
@Query("match (a:User)-[r:LIKE]-> (b:POST)\n" + |
|
|
|
|
"WHERE id(a) = $id AND id(b) = $idd\n" + |
|
|
|
|
"RETURN COUNT(r) > 0 AS Relationship") |
|
|
|
|
boolean checkLike(@Param("id") Long userId,@Param("idd") Long postId); |
|
|
|
|
|
|
|
|
|
// @Query("MATCH (user:User), (course:Course) WHERE user.username = $username AND course.identifier = $identifier " +
|
|
|
|
|
// "CREATE (user)-[:ENROLLED_IN]->(course) RETURN user, course")
|
|
|
|
|
// CourseEnrolmentQueryResult createEnrolmentRelationship(String username, String identifier);
|
|
|
|
|