defmodule Podbox.Podcast.AssetEnclosure do @moduledoc """ Join table between podcast enclosures and downloaded assets. """ use Ash.Resource, data_layer: AshSqlite.DataLayer, domain: Podbox.Podcast, notifiers: [Ash.Notifier.PubSub] alias Podbox.{Download.Asset, Podcast.Enclosure, Repo} @type t :: Ash.Resource.record() attributes do uuid_primary_key :id end relationships do belongs_to :asset, Asset, attribute_writable?: true, public?: true belongs_to :enclosure, Enclosure, attribute_writable?: true, public?: true end sqlite do table "podcast_asset_enclosures" repo Repo end pub_sub do module Podbox.PubSub prefix "podcast:asset_enclosure" publish :create, "created" end actions do defaults [:read, :destroy, create: :*, update: :*] end end