defmodule Podbox.Podcast.AssetFeed do @moduledoc """ Join table between podcast feeds and downloaded assets. """ use Ash.Resource, data_layer: AshSqlite.DataLayer, domain: Podbox.Podcast, notifiers: [Ash.Notifier.PubSub] alias Podbox.{Download.Asset, Podcast.Feed, 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 :feed, Feed, attribute_writable?: true, public?: true end sqlite do table "podcast_asset_feeds" repo Repo end pub_sub do module Podbox.PubSub prefix "podcast:asset_feed" publish :create, "created" end actions do defaults [:read, :destroy, create: :*, update: :*] end end