User1 creates a post, but User2 is unable to see that post until User1 gives permissions, does it mean that it is required to run mutation every time after the post is created to get its hypi.id?
Yes, there is currently no way to automatically give other users access. There are a few options available to you.
- You can create your own function which creates a post and then creates permission for the post. This can be done with a user-defined function - see https://docs.hypi.app/references/user-defined-functions
- Instead of option one, you can use a workflow that does exactly the same as the above https://docs.hypi.app/references/workflow - it’s just another way to do the same thing.
- You can add a trigger to the upsert method which will call your own function every time upsert is called. Note that the upsert signature must match the one Hypi defines and it is called for all types, not just post and your trigger must account for multiple types so I would recommend this unless you want to create a permission for all types created - see trigger documentation at https://docs.hypi.app/references/triggers
- You could do a combination of 1 or 2 with 3. Create your own function to create a post e.g. createPost - this function calls upsert, it also has a trigger that creates the permission. This is much better than adding a trigger directly to upsert.