Create relationship to user
Now that the view has been created, we need a way to be able to fetch user information based on the id
column of the view. Let's create a manual relationship from the view online_users
to the table users
using the id column
of the view.
Head to Console -> Data -> online_users -> Relationships page.
Add a new relationship manually by choosing the relationship type to be Object Relationship
. Enter the relationship name as user
.
Select the configuration for the current column as id
and the remote table would be users
and the remote column would be id
again.
We are mapping the current view's id column to users table's id column to create the relationship.
Let's explore the GraphQL APIs for the relationship created.
query {online_users {idlast_seenuser {idname}}}
Great! We are completely done with data modeling for the app.
- Build apps and APIs 10x faster
- Built-in authorization and caching
- 8x more performant than hand-rolled APIs