24 lines
850 B
Plaintext
24 lines
850 B
Plaintext
|
MATCH (person:Person {id:"17592186053137"})<-[:HAS_CREATOR]-(message)<-[like:LIKES]-(liker:Person)
|
||
|
WITH liker, message, like.creationDate AS likeTime, person
|
||
|
ORDER BY likeTime DESC, tointeger(message.id) ASC
|
||
|
WITH
|
||
|
liker,
|
||
|
collect(message)[0] AS latestLike_msg,
|
||
|
collect(likeTime)[0] AS latestLike_time,
|
||
|
person
|
||
|
OPTIONAL MATCH (liker)-[liker_knows_person:KNOWS]-(person)
|
||
|
RETURN
|
||
|
liker.id AS personId,
|
||
|
liker.firstName AS personFirstName,
|
||
|
liker.lastName AS personLastName,
|
||
|
latestLike_time AS likeTime,
|
||
|
latestLike_msg.id AS messageId,
|
||
|
CASE latestLike_msg.content is not null
|
||
|
WHEN true THEN latestLike_msg.content
|
||
|
ELSE latestLike_msg.imageFile
|
||
|
END AS messageContent,
|
||
|
latestLike_time - latestLike_msg.creationDate AS latencyAsMilli,
|
||
|
liker_knows_person is null AS isNew
|
||
|
ORDER BY likeTime DESC, tointeger(personId) ASC
|
||
|
LIMIT 10;
|