August 2025
Intermediate to advanced
294 pages
6h 59m
English
With our shiny new relationships in place, we can use them to determine if a given user follows a given artist and show that information in the app.
We’ll write this as a custom calculation, as an expression that uses the exists[177] sub-expression. exists lets us check if any records in a relationship match a given condition, so we can use it to check if any of an artist’s followers are the current user, the actor running this query.
This will be loaded as part of an Artist record and shown on the artist profile page, so the calculation can be put on the Tunez.Music.Artist resource:
| | calculations do |
| | calculate :followed_by_me, |
| | :boolean, |
| | expr(exists(follower_relationships, follower_id ... |
Read now
Unlock full access