Ash Framework
The Elixir backend framework for unparalleled productivity. Declarative tools that let you stop wasting time. Use with Phoenix LiveView or build APIs in minutes for your front-end of choice.
JoinAsh Framework
The Elixir backend framework for unparalleled productivity. Declarative tools that let you stop wasting time. Use with Phoenix LiveView or build APIs in minutes for your front-end of choice.
JoinHow to model context based multitenancy?
global? true
I can log in without knowing the tenant, but I'm not sure what the best strategy to fetch the tenant into after - or during - sign in, given the current_user has no tenant data
- If I use global? false
I need the tenant info before sign in, which can be work. I just need to figure it out how to build the magic link with the tenant subdomain - probably a phoenix question though.
Should I define my user resource as?...inline `type()` doesnt work. when defined as calculation on resource it works.
``ex
# this works, where
:id_as_string` is the calculation: expr(type(:id, :string))
authorize_if expr(^actor([:service, :id_as_string]) in addressed_groups)...Phoenix 1.18 Ash authentication error
/sign-in
or /register
on a new application I'm playing with.
``
[error] ** (RuntimeError) Cannot set assign
current_user before default
AshAuthentication.Phoenix.LiveSession.on_mount/4` has run.
(ash_authentication_phoenix 2.7.0) lib/ash_authentication_phoenix/live_session.ex:163: anonymous fn/5 in AshAuthentication.Phoenix.LiveSession.on_mount/4...manage_relationship to create another resource `belongs_to` relation
manage_relationship
will eventually call a create/update action etc., and you are providing inputs for it hereUsing seed and changeset generators with child resources
Child
resource that belongs_to
a Parent
. I'd like to use the seed and changeset generators with these resources in my tests. I'd like to
- generate the Child
along with a unique Parent
in one generator call
- child = generate(child_seed())
- child = generate(child_changeset())
...Bulk update through AshAdmin is skipping 200 records, not sure why
Calculation just ids from a relation
AshPaperTrail
``
[warning] Unhandled error in form submission for AshTableVue.GoldenDataset.Resources.Question.update
This error was unhandled because Ash.Error.Framework.MustBeAtomic does not implement the
AshPhoenix.FormData.Error` protocol.
...Reactor and webhook
Stripe.Checkout.Session.create
, redirected external session url. Then there's a webhook controller that constructs an event Stripe.Webhook.construct_event
.
how would that work using reactor flow? :thinkies: I'm guessing capture payment step should handle the webhook part, but I'm not understanding how would I plug the two? Is this even a valid use case for reactor 😬...AshJsonAPI generic action arguments in a GET route
query_params
option IIRC that determines which action inputs are lifted to query params thoughCalculation referencing a resource in a different schema
calculate :geom, :geometry, expr(fragment("ST_UNION(?)", lgas.geog))
calculate :geom, :geometry, expr(fragment("ST_UNION(?)", lgas.geog))
How to manage notifications
notes
instead of workspace
...Exist the postgres functions array on Ash queries
eq
or not_eq
```
anyarray <@ anyarray → boolean
...How to handle submit-only actions without data layer but with validations?
map datatype type form with ash_phoenix.gen.live
Actor attribute in relationship filter expression is NULL
destroy action based on filters
require_reference?: false
to the code interface, and then provide your own filters etc. in the action. (make sure to specify filters or it will delete everything)manage_relationship does not insert
Policies for `create` upsert actions
create do upsert? true end
type of action that I'd like to put a policy on. However, I get a warning that says I can't add policies to create actions, basically because the data doesn't exist yet to be able to authorize against. So this is a two part question.
Question 1:
When upserting, there is data. Is there a way to authorize that? Maybe I'm relying too heavily on upserts.
...Site