mirror of
https://github.com/ash-project/ash_postgres.git
synced 2024-09-20 21:43:12 +12:00
37cc01957d
* WIP * chore: fix mix.lock merge issues * improvement: upgrade to 3.0 * chore: remove `repo.to_tenant` * chore: continue removal of unnecessary helper * chore: use `Ash.ToTenant`
21 lines
648 B
Elixir
21 lines
648 B
Elixir
defmodule AshPostgres.Verifiers.ValidateReferences do
|
|
@moduledoc false
|
|
use Spark.Dsl.Verifier
|
|
alias Spark.Dsl.Verifier
|
|
|
|
def verify(dsl) do
|
|
dsl
|
|
|> AshPostgres.DataLayer.Info.references()
|
|
|> Enum.each(fn reference ->
|
|
unless Ash.Resource.Info.relationship(dsl, reference.relationship) do
|
|
raise Spark.Error.DslError,
|
|
path: [:postgres, :references, reference.relationship],
|
|
module: Verifier.get_persisted(dsl, :module),
|
|
message:
|
|
"Found reference configuration for relationship `#{reference.relationship}`, but no such relationship exists"
|
|
end
|
|
end)
|
|
|
|
:ok
|
|
end
|
|
end
|