kernel
AEAsh Elixir
•Created by kernel on 9/25/2023 in #support
Policy vs FieldPolicy
I haven't used FieldPolicy before, but lets say I have a :role attribute that I want to control changes to. I.e: :god should be able to create users with all roles, :admin should only be able to create :admin and :user, and :user should not be able to create any roles - but still able to edit their own account i.e: change their email etc. Would a field policy be the place for that these days?
28 replies
AEAsh Elixir
•Created by kernel on 9/15/2023 in #support
Issues using Ash.Type.Union
So I'm trying to use Ash.Type.Union and I keep getting errors when attempting to load the resource,
I have defined an embedded resource
51 replies
AEAsh Elixir
•Created by kernel on 6/24/2023 in #support
pattern to use for embedded resources with variable fields?
I'm brainstorming how I'd be able to have embedded resources that have variable schemas, lets say I have a SocialMediaAccount resource, and I want an 'adapter_config' column that will be a set of config to integrate with the SocialMediaAccount, i.e: twitter api keys etc
I'm going to implement an adapter pattern type thing that will include validations and a few methods to integrate with the social platform, I'm just wondering how I'd define that column in my resource?
I was thinking of just using a map type - then handling validations etc in a custom change / validation?
22 replies
AEAsh Elixir
•Created by kernel on 6/16/2023 in #support
manage_relationship :remove across API's
I have a
Tag
resource that belongs in the Organization
API, I have a Transaction
resource that belongs in the Transactions
API, there is a join resource between them called TransactionTag
that is in the Transaction
API registry.
I am unable to manage_relationship :remove
a Tag
from a Transaction
resource unless I also include the TransactionTag
resource in the Organization
registry. (I get a ResourceNotAllowed error otherwise)
Is this expected behaviour?
Am I footgunning myself if I do this just because it works?6 replies
AEAsh Elixir
•Created by kernel on 6/6/2023 in #support
Few Ash.Flow questions
I've just started playing with Ash.Flow and I've got a few questions.
1) Is it possible to have a branch step with a condition like
expr(Money.positive(^arg(:amount)))
, I've tried and get a Spark DSL error.
2) Is there a neater way to get_by
a resource (similar to how we do it for code_interface) than having to define a separate action? - or does this go against the ethos of Ash.Flow
, currently it seems slightly disjointed, with one part of the API encouraging one way and providing nice helpers, but another part not being really integrated, I'm assuming this is just me wanting to use it wrong and carry over certain bad habits / not knowing the magic helpers that do exist...
3) Are there plans to have a flow be able to be invoked via a code_interface?
4) Related to #2, is the input
of a read step passed through to the action directly, i.e: can I pass in a load/2
as part of the input
template? Or is it encouraged to just have a separate step loading the related data?
5) if I wanted to calculate some values within a Flow, I assume I'm doing it wrong? I could use a Custom step for that, but that itself seems like using the wrong tool for the job.5 replies
AEAsh Elixir
•Created by kernel on 5/9/2023 in #support
Aggregates still not working correctly
I have a few custom aggregates that have a filter on them that don't seem to work anymore.
generates sql that doesn't include the filter at all
This had worked before, but I'm assuming with the changes made to aggregates was broken
24 replies
AEAsh Elixir
•Created by kernel on 2/24/2023 in #support
Auth0 and AshAuthentication
with AshAuthentication and auth0, what should I specify as the user resource attributes?
like, email etc etc, what if I want different roles? i.e: admin users and normal users? can I specify a role attribute on the resource - and have that saved in auth0 somehow?
32 replies
AEAsh Elixir
•Created by kernel on 2/12/2023 in #support
Another calculations query
I have 'Job' which is related to a 'Service' via another resource (not defined as a :through).
I need a calculation that does something like
I've already defined the
first
aggregates, but now I'm getting an error telling me that I need to provide field type for first
, so I'm assuming that something along my chain of first aggregates is not working?
or am I not allowed to define an aggregate of an aggregate?27 replies