jeroen11dijk
jeroen11dijk
AEAsh Elixir
Created by Robert Graff on 5/2/2023 in #support
Best way to skip tenant check on a query
I agree that it worked as intended but the workaround is really nice! I like the passing of the context, but now have to figure out how to update ash xD
31 replies
AEAsh Elixir
Created by Robert Graff on 5/2/2023 in #support
Best way to skip tenant check on a query
My problem now is that I have a read
read :read do
primary? true
prepare build(load: [:partner_depot])

multitenancy :bypass
end
read :read do
primary? true
prepare build(load: [:partner_depot])

multitenancy :bypass
end
And then I get
** (Ash.Error.Invalid)
Bread Crumbs:
> Error returned from: Zelo.Company.Depot.read
> Error returned from: Zelo.Delegations.Partner.read

Invalid Error

* Queries against the Zelo.Company.Depot resource require a tenant to be specified
at partner_depot
** (Ash.Error.Invalid)
Bread Crumbs:
> Error returned from: Zelo.Company.Depot.read
> Error returned from: Zelo.Delegations.Partner.read

Invalid Error

* Queries against the Zelo.Company.Depot resource require a tenant to be specified
at partner_depot
Which I want to disable. I dont want to add the bypass to the depot read since its used elsewhere so can I overwrite this or set a custom read of the depots for this action
31 replies
AEAsh Elixir
Created by Robert Graff on 5/2/2023 in #support
Best way to skip tenant check on a query
That works for a read acion. I think I can work with that, thanks!
31 replies
AEAsh Elixir
Created by Robert Graff on 5/2/2023 in #support
Best way to skip tenant check on a query
Im currently running into the same issue. I can indeed set global? true but that means that you can query it without tenant everywhere if I read the docs correctly. I want the tenant to always be required but being able to override/bypass it this one time. Are there currently any methods of doing this?
31 replies
AEAsh Elixir
Created by jeroen11dijk on 6/4/2025 in #support
destroy action based on filters
Thanks that works!
9 replies
AEAsh Elixir
Created by jeroen11dijk on 6/4/2025 in #support
destroy action based on filters
def delete_replannable_routes(depot_id, date, user) do
case Route.replannable_routes_by_date(depot_id, date,
actor: user,
tenant: user.company_id
) do
{:ok, replan_routes} ->
case Route.delete(routes, [bulk_options: [notify?: true, return_errors?: true]] ++ opts) do
%{status: :success, error_count: 0} ->
route_ids = Enum.map_join(routes, ", ", & &1.friendly_id)
message = "deleted routes: #{route_ids}"
{:ok, message}

%{error_count: error_count, errors: errors} when error_count > 0 ->
{:error, errors}
end

{:error, reason} ->
{:error, reason}
end
end
def delete_replannable_routes(depot_id, date, user) do
case Route.replannable_routes_by_date(depot_id, date,
actor: user,
tenant: user.company_id
) do
{:ok, replan_routes} ->
case Route.delete(routes, [bulk_options: [notify?: true, return_errors?: true]] ++ opts) do
%{status: :success, error_count: 0} ->
route_ids = Enum.map_join(routes, ", ", & &1.friendly_id)
message = "deleted routes: #{route_ids}"
{:ok, message}

%{error_count: error_count, errors: errors} when error_count > 0 ->
{:error, errors}
end

{:error, reason} ->
{:error, reason}
end
end
Currently doing this which works fine, I was just wondering if I could change the type of the action to a destroy, but then it seems to always require a route anyway
9 replies
AEAsh Elixir
Created by jeroen11dijk on 5/26/2025 in #support
Error: `key :manual not found in: nil` with create_query using graphql
its really nice way to setup the API though
13 replies
AEAsh Elixir
Created by jeroen11dijk on 5/26/2025 in #support
Error: `key :manual not found in: nil` with create_query using graphql
misread the error, and I got it to work 😅
13 replies
AEAsh Elixir
Created by jeroen11dijk on 5/26/2025 in #support
Error: `key :manual not found in: nil` with create_query using graphql
How do I define the attribute as an array so I can expose it for graphql
attribute {:array, Zelo.Planner.RouteResult} do
allow_nil? false
public? true
end
attribute {:array, Zelo.Planner.RouteResult} do
allow_nil? false
public? true
end
This doesnt work but using map also doesnt sound great
13 replies
AEAsh Elixir
Created by jeroen11dijk on 5/26/2025 in #support
Error: `key :manual not found in: nil` with create_query using graphql
Thanks that was exactly it 😃
13 replies
AEAsh Elixir
Created by jeroen11dijk on 5/26/2025 in #support
Error: `key :manual not found in: nil` with create_query using graphql
I also tried adding the default read but then I get the error that there is no data and that I need to use set_data somewhere but it also seems unclear to me where. Since using it in read seems like it would already be too late
13 replies
AEAsh Elixir
Created by jeroen11dijk on 5/26/2025 in #support
Error: `key :manual not found in: nil` with create_query using graphql
And so far I have been unable to get around this, although using a primary create with manage_relationships seems the way to go
13 replies
AEAsh Elixir
Created by jeroen11dijk on 5/26/2025 in #support
Error: `key :manual not found in: nil` with create_query using graphql
(Ash.Error.Unknown) Bread Crumbs:
Exception raised in: Zelo.Planner.PlanResult.run_planner Exception raised in: Zelo.Planner.PlanResult.run_planner
Unknown Error *
(KeyError) key :manual not found in: nil If you are using the dot syntax, such as map.field, make sure the left-hand side of the dot is a map (ash 3.5.10) lib/ash/actions/read/read.ex:437: Ash.Actions.Read.load_relationships/3 (ash 3.5.10) lib/ash/actions/read/read.ex:354: Ash.Actions.Read.do_run/3 (ash 3.5.10) lib/ash/actions/read/read.ex:89: anonymous fn/3 in Ash.Actions.Read.run/3 (ash 3.5.10) lib/ash/actions/read/read.ex:88: Ash.Actions.Read.run/3 (ash 3.5.10) lib/ash.ex:1914: Ash.load/3 (ash 3.5.10) lib/ash.ex:1868: Ash.load/3 (ash 3.5.10) lib/ash/actions/helpers.ex:713: Ash.Actions.Helpers.load/4 (ash 3.5.10) lib/ash/actions/create/create.ex:488: Ash.Actions.Create.commit/3 (ash 3.5.10) lib/ash/actions/create/create.ex:132: Ash.Actions.Create.do_run/4 (ash 3.5.10) lib/ash/actions/create/create.ex:50: Ash.Actions.Create.run/4 (ash_graphql 1.7.10) lib/graphql/resolver.ex:1510: AshGraphql.Graphql.Resolver.mutate/2 (absinthe 1.7.9) lib/absinthe/phase/document/execution/resolution.ex:234: Absinthe.Phase.Document.Execution.Resolution.reduce_resolution/1 (absinthe 1.7.9) lib/absinthe/phase/document/execution/resolution.ex:189: Absinthe.Phase.Document.Execution.Resolution.do_resolve_field/3 (absinthe 1.7.9) lib/absinthe/phase/document/execution/resolution.ex:174: Absinthe.Phase.Document.Execution.Resolution.do_resolve_fields/6 (absinthe 1.7.9) lib/absinthe/phase/document/execution/resolution.ex:145: Absinthe.Phase.Document.Execution.Resolution.resolve_fields/4 (absinthe 1.7.9) lib/absinthe/phase/document/execution/resolution.ex:88: Absinthe.Phase.Document.Execution.Resolution.walk_result/5 (absinthe 1.7.9) lib/absinthe/phase/document/execution/resolution.ex:67: Absinthe.Phase.Document.Execution.Resolution.perform_resolution/3 (absinthe 1.7.9) lib/absinth (ash 3.5.10) lib/ash/actions/read/read.ex:437: Ash.Actions.Read.load_relationships/3 (ash 3.5.10) lib/ash/actions/read/read.ex:354: Ash.Actions.Read.do_run/3 (ash 3.5.10) lib/ash/actions/read/read.ex:89: anonymous fn/3 in Ash.Actions.Read.run/3 (ash 3.5.10) lib/ash/actions/read/read.ex:88: Ash.Actions.Read.run/3 (ash 3.5.10) lib/ash.ex:1914: Ash.load/3 (ash 3.5.10) lib/ash.ex:1868: Ash.load/3 (ash 3.5.10) lib/ash/actions/helpers.ex:713: Ash.Actions.Helpers.load/4 (ash 3.5.10) lib/ash/actions/create/create.ex:488: Ash.Actions.Create.commit/3 (ash 3.5.10) lib/ash/actions/create/create.ex:132: Ash.Actions.Create.do_run/4 (ash 3.5.10) lib/ash/actions/create/create.ex:50: Ash.Actions.Create.run/4 (ash_graphql 1.7.10) lib/graphql/resolver.ex:1510: AshGraphql.Graphql.Resolver.mutate/2 (absinthe 1.7.9) lib/absinthe/phase/document/execution/resolution.ex:234: Absinthe.Phase.Document.Execution.Resolution.reduce_resolution/1 (absinthe 1.7.9) lib/absinthe/phase/document/execution/resolution.ex:189: Absinthe.Phase.Document.Execution.Resolution.do_resolve_field/3 (absinthe 1.7.9) lib/absinthe/phase/document/execution/resolution.ex:174: Absinthe.Phase.Document.Execution.Resolution.do_resolve_fields/6 (absinthe 1.7.9) lib/absinthe/phase/document/execution/resolution.ex:145: Absinthe.Phase.Document.Execution.Resolution.resolve_fields/4 (absinthe 1.7.9) lib/absinthe/phase/document/execution/resolution.ex:88: Absinthe.Phase.Document.Execution.Resolution.walk_result/5 (absinthe 1.7.9) lib/absinthe/phase/document/execution/resolution.ex:67: Absinthe.Phase.Document.Execution.Resolution.perform_resolution/3 (absinthe 1.7.9) lib/absinthe/phase/document/execution/resolution.ex:24: Absinthe.Phase.Document.Execution.Resolution.resolve_current/3 (absinthe 1.7.9) lib/absinthe/pipeline.ex:408: Absinthe.Pipeline.run_phase/3 (absinthe_plug 1.5.9) lib/absinthe/plug.ex:545: Absinthe.Plug.run_query/4
13 replies