Skip to content

add tenant to ash bindings #534

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 22, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/data_layer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2172,7 +2172,7 @@
end
end

defp maybe_update_tenant(resource, changeset, result) do

Check warning on line 2175 in lib/data_layer.ex

View workflow job for this annotation

GitHub Actions / ash-ci (16) / mix dialyzer

unused_fun

Function maybe_update_tenant/3 will never be called.

Check warning on line 2175 in lib/data_layer.ex

View workflow job for this annotation

GitHub Actions / ash-ci (15) / mix dialyzer

unused_fun

Function maybe_update_tenant/3 will never be called.

Check warning on line 2175 in lib/data_layer.ex

View workflow job for this annotation

GitHub Actions / ash-ci (14) / mix dialyzer

unused_fun

Function maybe_update_tenant/3 will never be called.
if AshPostgres.DataLayer.Info.manage_tenant_update?(resource) do
changing_tenant_name? =
resource
Expand Down Expand Up @@ -3062,7 +3062,7 @@
end

@impl true
def update(resource, changeset) do

Check warning on line 3065 in lib/data_layer.ex

View workflow job for this annotation

GitHub Actions / ash-ci (16) / mix dialyzer

no_return

Function update/2 has no local return.

Check warning on line 3065 in lib/data_layer.ex

View workflow job for this annotation

GitHub Actions / ash-ci (15) / mix dialyzer

no_return

Function update/2 has no local return.

Check warning on line 3065 in lib/data_layer.ex

View workflow job for this annotation

GitHub Actions / ash-ci (14) / mix dialyzer

no_return

Function update/2 has no local return.
source = resolve_source(resource, changeset)

query =
Expand All @@ -3072,7 +3072,13 @@
AshPostgres.SqlImplementation,
changeset.context
)
|> pkey_filter(changeset.data)

Check warning on line 3075 in lib/data_layer.ex

View workflow job for this annotation

GitHub Actions / ash-ci (16) / mix dialyzer

apply

Function application with args (%Ecto.Query{

Check warning on line 3075 in lib/data_layer.ex

View workflow job for this annotation

GitHub Actions / ash-ci (15) / mix dialyzer

apply

Function application with args (%Ecto.Query{

Check warning on line 3075 in lib/data_layer.ex

View workflow job for this annotation

GitHub Actions / ash-ci (14) / mix dialyzer

apply

Function application with args (%Ecto.Query{
|> then(fn query ->

Check warning on line 3076 in lib/data_layer.ex

View workflow job for this annotation

GitHub Actions / ash-ci (16) / mix dialyzer

no_return

The created anonymous function has no local return.

Check warning on line 3076 in lib/data_layer.ex

View workflow job for this annotation

GitHub Actions / ash-ci (15) / mix dialyzer

no_return

The created anonymous function has no local return.

Check warning on line 3076 in lib/data_layer.ex

View workflow job for this annotation

GitHub Actions / ash-ci (14) / mix dialyzer

no_return

The created anonymous function has no local return.
%{
query
| __ash_bindings__: Map.put_new(query.__ash_bindings__, :tenant, changeset.tenant)

Check warning on line 3079 in lib/data_layer.ex

View workflow job for this annotation

GitHub Actions / ash-ci (16) / mix dialyzer

map_update

Attempted to update key :__ash_bindings__ in a map that does not have that key.

Check warning on line 3079 in lib/data_layer.ex

View workflow job for this annotation

GitHub Actions / ash-ci (15) / mix dialyzer

map_update

Attempted to update key :__ash_bindings__ in a map that does not have that key.

Check warning on line 3079 in lib/data_layer.ex

View workflow job for this annotation

GitHub Actions / ash-ci (14) / mix dialyzer

map_update

Attempted to update key :__ash_bindings__ in a map that does not have that key.
}
end)

changeset =
Ash.Changeset.set_context(changeset, %{
Expand Down
Loading