defmodule Foo.Bar.LiveFeatureFlags do
use Ash.Resource, data_layer: AshPostgres.DataLayer
postgres do
table "live_feature_flags"
repo Repo
end
atributes do
uuid_primary_key :id
attribute :name, :string, allow_nil?: false
attribute :description, :string, allow_nil?: false
attribute :is_enabed, :boolean, allow_nil?: false
end
actions do
defaults [:create, :read, :update, :destroy]
read :is_enabled? do
argument :name, :string do
allow_nil? false
end
filter expr(name == ^arg(:name))
get? true
end
end
code_interface do
define :create
define :read
define :update
define :destroy
end
end
defmodule Foo.Bar.LiveFeatureFlags do
use Ash.Resource, data_layer: AshPostgres.DataLayer
postgres do
table "live_feature_flags"
repo Repo
end
atributes do
uuid_primary_key :id
attribute :name, :string, allow_nil?: false
attribute :description, :string, allow_nil?: false
attribute :is_enabed, :boolean, allow_nil?: false
end
actions do
defaults [:create, :read, :update, :destroy]
read :is_enabled? do
argument :name, :string do
allow_nil? false
end
filter expr(name == ^arg(:name))
get? true
end
end
code_interface do
define :create
define :read
define :update
define :destroy
end
end