Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
11-04-2020 09:09 AM
My current model is similar to this:
type User {
id: ID!
friends: [Friend]
stories: [Story] @relation(name: "WROTE", direction: "OUT")
}
type Friend @relation(name: "FRIEND") {
id: ID!
from: User!
to: User!
}
type Story {
id: ID!
user: User @relation(name: "WROTE", direction: "IN")
}
My feed query is this:
userFriendsStories(email: String, cursor: String, limit: String): [Story]
@cypher(
statement: """
call {
match (u:User {email: $email})-[:FRIEND]-(:User)-[:WROTE]-(s:Story)
where s.updated < datetime($cursor)
return s
union
match (u:User {email: $email})-[:WROTE]-(s:Story)
where s.updated < datetime($cursor)
return s
}
return s
order by s.updated desc
limit toInteger($limit)
"""
)
So currently I get all the stories my friends and I have written.
Now I'd like to support a Distribution list for the Story which is a subset of the Friends and may not include me.
How should I model this and how would that impact the query above?
I think I can add a Relationship on the Story that is the Distribution. How can the query limit the returned Stories only when the Distribution List exists and I am on that list? If the Distribution list is null, then all the Friend Stories will return as the query now does.
All the sessions of the conference are now available online