Ownership pipes
It often happens that the owner of a specific entity should be the only one with the authority to edit it. In such cases, the ownership pipes pattern comes in handy, allowing editing of an object exclusively by its owner.
One of the most common use cases for ownership pipes is a blog. Here, every user of a blog is also the owner of their articles, and the only one who can edit them, add a cover image, set the publication date, and so on. Additionally, there are blog readers who can comment on each article, as well as edit their own comments and react to other comments. Once again, ownership of these objects and actions lies with the user. Furthermore, each user – whether a blog writer or commenter – has access to their own profile data and can edit it.
Just like in the previous section, we will start here by presenting the graph of our GraphQL schema for a blogging system:
Figure 4.4: Graph presenting blog service schema...