DEV Community

Discussion on: Data Modeling in Depth with GraphQL & AWS Amplify - 17 Data Access Patterns

Collapse
codemochi profile image
Code Mochi

Hey Ricardo,
I'm obviously not Nader, but what if you created two tables "users" and "userLikes"? When someone clicks the like button, you create a new "userLike" document where you have a liker and a likee field? You could then easily do lookups based on the liker and likee, especially if you added them as one to many relationships on the "user" document. This would be the basic relationships:

user {
   admirers: [userLikes]
   crushes: [userLikes]
}

userLikes {
   liker: user
   likee: user
   isBlocked: boolean/string
}

You could add latitude/longitude and use the between that Nader mentions above and then use booleans for some of those other specifications such as blocked.