In user
service:
type User {
isPrivate: Boolean
...
}
type Query {
user(userID: String): User
}
In social
service.
type Query {
followers(userID: String): [User]
}
In followers
query, I want to return empty array if userID
is a private and the requester isn’t approved follower of userID
.
So, I can manually query user(userID)
when resolving followers
query in social
service. And check if the user is private and if I’m the user’s follower.
Is there a better way to structure this? Ideally, I don’t want to manually query user(userID)
in social
service.
I almost want to have federation resolve parameters like:
type Query {
# taking User object as parameter (but only isPrivate field from User object)
followers(user: User { isPrivate }): [User]
}
And clients will query followers(userID)
and have federation resolve the userID
to User
.