Skip to content

Commit

Permalink
chore: format/test
Browse files Browse the repository at this point in the history
  • Loading branch information
zachdaniel committed Feb 17, 2025
1 parent 64d768c commit 5377c15
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
14 changes: 10 additions & 4 deletions lib/data_layer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2372,7 +2372,12 @@ defmodule AshPostgres.DataLayer do
{:error, Ash.Error.to_ash_error(error, stacktrace)}
end

defp constraints_to_errors(%{constraints: user_constraints} = changeset, action, constraints, resource) do
defp constraints_to_errors(
%{constraints: user_constraints} = changeset,
action,
constraints,
resource
) do
Enum.map(constraints, fn {type, constraint} ->
user_constraint =
Enum.find(user_constraints, fn c ->
Expand All @@ -2390,9 +2395,10 @@ defmodule AshPostgres.DataLayer do
identities = Ash.Resource.Info.identities(resource)
table = AshPostgres.DataLayer.Info.table(resource)

identity = Enum.find(identities, fn identity ->
"#{table}_#{identity.name}_index" == constraint
end)
identity =
Enum.find(identities, fn identity ->
"#{table}_#{identity.name}_index" == constraint
end)

field_names = if identity, do: identity.field_names, else: [field]

Expand Down
2 changes: 1 addition & 1 deletion test/calculation_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ defmodule AshPostgres.CalculationTest do

assert [%{first_name: "abc"}, %{first_name: "tom"}] =
Author
|> Ash.Query.sort(param_full_name: [separator: "~"])
|> Ash.Query.sort(param_full_name: %{separator: "~"})
|> Ash.read!()
end

Expand Down

0 comments on commit 5377c15

Please sign in to comment.