Jan Ulbrich
AEAsh Elixir
•Created by Jan Ulbrich on 8/27/2023 in #support
Ash.Resource.ManualRead And Filters
Hi, I’m wrapping an external REST API with an Ash resource and therefor use
Ash.Resource.ManualRead
. Reading the data is not a problem, but as the REST API is way less capable for filtering, I would like to run the returned data through the Ash filters I applied to the query. I mapped the returned data already to the Ash resource and now have an array of these resources. But how can I now apply the filters from the query? That’s what read!()
normally would do, but calling that would lead to a recursion…3 replies
AEAsh Elixir
•Created by Jan Ulbrich on 8/12/2023 in #support
JSON-API And Calculations
Hi, I have a couple of calculations on my models and they seamlessly work in GraphQL. Now I need to make them accessible from the JSON-API and find no automatic way to address them. Do I need to write an extra-route or how should I approach this?
18 replies
AEAsh Elixir
•Created by Jan Ulbrich on 6/28/2023 in #support
JSON-API Related() Seems Broken
Hi, 👋 there seems to be a regression in the JSON-API: It worked nicely (after you did a fix a couple of weeks ago), but after updating packages to the newest ones, I get an exception.
Here’s the relation:
This is the exception I get:
4 replies
AEAsh Elixir
•Created by Jan Ulbrich on 6/3/2023 in #support
GraphQL Relationship Resolved w/o Context
Hi there, 👋
I have a query like
which I need to filter with a
Ash.Query.after_action
.
The filter is called as expected, but the actor of the request (available in the outer filter with the correct value) is nil
for this nested.
Do I manually need to forward the context in some way or might that be a bug?
This is the stack trace raising an exception from Ash.Query.after_action
(no error, but manually raised to get the stack):
29 replies
AEAsh Elixir
•Created by Jan Ulbrich on 5/17/2023 in #support
Compile Error with JsonApi using related()
Hi there! 👋 I’m getting error message "(ArgumentError) Found an action of type read while looking for an action of type get_related, Perhaps you passed a changeset with the incorrect action type into your Api?" and I don’t understand how to solve it.
Here’s the code:
I’m using the
main
branch of ash_json_api
together with ash
2.9.4
. I went through all Spark DSL stuff, but couldn’t find a clue about get_related
searching the documentation.5 replies
AEAsh Elixir
•Created by Jan Ulbrich on 2/17/2023 in #support
Found read action while expecting an action of type relationship...
Hi, I need to customise a relation get the following error when trying to implement something like
relationship(:events, :events_by_extid)
:
** (ArgumentError) Found an action of type read while looking for an action of type relationship
The message itself is pretty obvious, but I can’t find a definition of how a relationship
action would look like… 😇23 replies
AEAsh Elixir
•Created by Jan Ulbrich on 1/27/2023 in #support
Update Route W/ Arguments
I have a read action (and JSON API route) that takes an alternative identifer
:extid
instead of looking for the :id
column. Now I would like the same route as an alternative for updates, too.
The update
understands the argument
like the read
does, but I don’t see how I can modifiy the query to read the correct record.
A change
can have an optional where
which takes a list of functions, but I don’t get what these functions should look like…50 replies
AEAsh Elixir
•Created by Jan Ulbrich on 1/24/2023 in #support
Row Level Permissions
Hi, I’m trying to return certain attributes only for some user roles aka implementing row level permissions. Currently I’m doing that with an prepare/after_action block and while that works, it doesn’t feel natural. Filters and checks don’t help and removing attributes with the after_action make them still appear in the output of AshJsonApi and I would prefer them to not appear at all. Are there other approaches I could take?
18 replies
AEAsh Elixir
•Created by Jan Ulbrich on 1/23/2023 in #support
Modifying results after reading
Hi, 👋 I need to manipulate the data returned from a database query. I found out how to do my own read based on Ash.Resource.ManualRead, but how can I call the default logic to apply my changes afterwards? Or is there some kind of after_read hook where I could do so? I would appreciate som pointers… 😇
12 replies