Ash JSON API - Relationship tenant
Hi!
I am currently implementing some API endpoints for some resources and stumbled up on a case where I cannot figure out a good pattern to assign the tenant when using
My main resource is not using tenancy, but all the relationships do.
I am using
Usually when doing manual queries I load the main resource, assign the tenant and finally use
But I cannot seem to find a good and reusable pattern to do this now when I am using
- I have tried using preparations, this does not carry over the "parent" so I cannot add the tenant here
- I have also tried to use manual relationships, but this quickly got a bit to explicit when a relationship is using
Is there a better and more general pattern for this? Or do I have to implement a
Thanks!
I am currently implementing some API endpoints for some resources and stumbled up on a case where I cannot figure out a good pattern to assign the tenant when using
related and relationship.My main resource is not using tenancy, but all the relationships do.
I am using
context based multitenancy.Usually when doing manual queries I load the main resource, assign the tenant and finally use
load(..) But I cannot seem to find a good and reusable pattern to do this now when I am using
ash_json_api - I have tried using preparations, this does not carry over the "parent" so I cannot add the tenant here
- I have also tried to use manual relationships, but this quickly got a bit to explicit when a relationship is using
from_many? etc as I needed to implement AshPostgres.ManualRelationship for each resource as the join would be difference. If I understood it correctly.Is there a better and more general pattern for this? Or do I have to implement a
Ash.Resource.ManualRelationship module for all resources I want to use in this way?Thanks!

Ash