-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
why contents와 createdAt보다 많은 정보가 피드에 필요함 how 게시글에 딸린 댓글, 작성자, 좋아요 갯수, 좋아요 여부를 포함해서 반환하도록 쿼리 작성
- Loading branch information
1 parent
05d4ad9
commit 49a0026
Showing
1 changed file
with
15 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,18 @@ where feed.createdAt < datetime({cursor}) | |
RETURN user.nickname as nickname, user.thumbnail as thumbnail , | ||
feed.content as content ,apoc.convert.toString(feed.createdAt) as createdAt | ||
LIMIT {first} `; | ||
export { MATCH_NEW_FEEDS }; | ||
|
||
const MATCH_FEEDS = `MATCH (searchUser:User)-[:AUTHOR]->(feed:Feed) | ||
OPTIONAL MATCH (likeUser:User)-[:LIKE]->(feed) | ||
OPTIONAL MATCH (feed)-[:HAS]->(com:Comment) | ||
WITH searchUser, feed, COLLECT(likeUser) AS cp , COLLECT(com) as comments | ||
where feed.createdAt < datetime({cursor}) | ||
RETURN searchUser , feed , length(cp) AS totallikes, | ||
length(filter(x IN cp WHERE x.email='[email protected]')) AS hasLiked, comments | ||
LIMIT {first} `; | ||
|
||
const MATCH_NEW_FEEDS2 = `MATCH (user:User { email: '[email protected]' })-[:AUTHOR]->(feed:Feed) | ||
where feed.createdAt < datetime('9999-12-31T09:29:26.050Z') | ||
RETURN feed`; | ||
|
||
export { MATCH_NEW_FEEDS, MATCH_NEW_FEEDS2, MATCH_FEEDS }; |