I’m creating a social networking platform, contains users categories and challenges as posts, each post has a relation with the user as author and category, for the user type it has relation with other users in (UID-list-reverse) followers Predicate same for the category,
What I want to do
I wanted to write a query that lists all challenges the user is following.
What I did
I've tried this query
{
user(func: type(user)) {
x as uid
following:~followers {
uid
}
challenge: @filter(eq(author,val(x))){
uid
expand(_all_)
}
}
}
error:
while converting to subgraph: uid not allowed multiple times in same sub-query.
ps:
I know it doesn’t do what I want but worth the try
Dgraph schema
schema
<active>: bool @index(bool) .
<author>: uid @reverse .
<bDate>: datetime .
<bio>: string .
<cateId>: string @index(exact) .
<category>: uid @reverse .
<challenge>: uid @reverse .
<comments>: [uid] @count .
<content>: string @index(term) .
<createdAt>: datetime .
<description>: string @index(term) .
<downVotes>: [uid] @count @reverse .
<email>: string @index(exact) .
<fName>: string @index(term) .
<followers>: [uid] @count @reverse .
<isApproved>: bool @index(bool) .
<isChallenge>: uid @reverse .
<lName>: string @index(term) .
<lastSignIn>: datetime .
<multiMedia>: [uid] @count @reverse .
<name>: string @index(term) .
<password>: password .
<replayTo>: uid @reverse .
<uName>: string @index(exact) .
<upVotes>: [uid] @count @reverse .
type <category> {
name
description
cateId
createdAt
isApproved
followers
}
type <challenge> {
author
category
content
createdAt
isChallenge
multiMedia
upVotes
downVotes
comments
}
type <comment> {
author
challenge
content
createdAt
upVotes
downVotes
replayTo
comments
}
type <user> {
fName
lName
uName
email
bDate
lastSignIn
password
bio
active
followers
}