You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Say you have two entities, user and community. Each have their own unique fields but share relations like Post.
I'm trying to figure out if there is a right way to structure this.
(1) Access Post through User. I can check to see if user has permission to view the post before fetching based.
(BAD) I'd need separate GQL queries for both User and Community and updating the cache gets more complex needing both a useCreateUserPost and useCreateCommunityPost.
(GOOD) My permission checks on the backend are easier.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Say you have two entities,
user
andcommunity
. Each have their own unique fields but share relations likePost
.I'm trying to figure out if there is a right way to structure this.
(1) Access
Post
throughUser
. I can check to see if user has permission to view the post before fetching based.User
andCommunity
and updating the cache gets more complex needing both auseCreateUserPost
anduseCreateCommunityPost
.(2) I can directly access the post. I can check after the post is fetched to see if the user has permission to view.
user
orcommunity
post, then run permission checksuseCreatePost
oruseFetchPost
for bothuser
andcommunity
pages.I suppose when is it a good idea to do one or the other in cases like this?
Beta Was this translation helpful? Give feedback.
All reactions