I’m working on a social network using a graph-db, I have just migrated from a different graph-db provider so I already have my own schema, except that it is a bit different.
So far I’m having issues with retrieving the count (int)
of the edges (relashionships)
between two nodes and whether an edge does exists or not (Boolean)
.
As for the nodes I have the (User)
node and the (Post)
node, so I’m trying to retrieve the count of Posts created by the User, count of Users following User
and whether User is following User
and in the Post (type)
I have "likes_count"
, "comments_count"
and "user_liked" (Boolean)
that I want to retrieve with each query too.
My schema looks like this.
type User {
id: ID
created_at: String
user_id: ID! @id
username: String! @id
is_private: Boolean
#count of posts created including the one reposted (shared)
created_posts_count: Int #THIS
following_count: Int #THIS
followers_count: Int #THIS
following: Boolean #THIS
followed_by: Boolean #THIS
blocked_by: Boolean #THIS
}
type Post{
post_id: String
text: String
likes_count: int #THIS
comments_count: int #THIS
post_author: User
user_created: Boolean #THIS
user_liked: Boolean #THIS
user_favourited: Boolean #THIS
user_shared: Boolean #THIS
user_commented: Boolean #THIS
}
the properties that I’m interested about are the ones that have (#THIS) next to them.
Can they be extended with DQL so these properites are retrieved with each query that returns result for User and Post node?