defmodule Podbox.Podcast.Category do @moduledoc """ A podcast category """ alias Podbox.{Podcast, Repo} use Ash.Resource, data_layer: AshSqlite.DataLayer, domain: Podcast, notifiers: [Ash.Notifier.PubSub] @type t :: Ash.Resource.record() attributes do uuid_primary_key :id attribute :resource_id, :uuid, allow_nil?: false attribute :name, :string, allow_nil?: false, public?: true attribute :domain, :string, allow_nil?: false, public?: true create_timestamp :inserted_at update_timestamp :updated_at end actions do defaults [:read, :destroy, create: :*, update: :*] end pub_sub do module Podbox.PubSub prefix "podcast:category" publish :create, "created" publish :destroy, "destroyed" end sqlite do polymorphic? true repo Repo end end