Current section
Files
Jump to
Current section
Files
lib/arke_postgres/tables/arke_auth.ex
defmodule ArkePostgres.ArkeAuth do
use Ecto.Schema
import Ecto.Changeset
@arke_auth_fields ~w[type parent_id child_id configuration]a
@foreign_key_type :string
schema "arke_auth" do
field(:type, :map, default: %{read: true, write: false, delete: false, shared_by: false})
belongs_to(:parent_id, ArkePostgres.ArkeUnit, primary_key: true)
belongs_to(:child_id, ArkePostgres.ArkeUnit, primary_key: true)
field(:configuration, :map, default: %{}, primary_key: true)
end
def changeset(args \\ []) do
%__MODULE__{}
|> cast(args, @arke_auth_fields)
|> validate_required(@arke_auth_fields)
end
end